<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><div id="myscoll"></div><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>前端+后端知识汇总（1） | 晚夜微雨问海棠のBlog</title><meta name="keywords" content="知识"><meta name="author" content="晚夜微雨问海棠"><meta name="copyright" content="晚夜微雨问海棠"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="前言: 在学项目课的时候，三个目的： 1.学习自学能力 2.学习调 bug 的能力 3.学习分析解决问题的能力  背景音乐 外链式音乐，网易云音乐网址的 ID 复制过来即可  例如:&lt;送你一朵小红花：1804797118&gt; 1234&lt;audio autoplay&#x3D;&quot;autopaly&quot; loop&#x3D;&quot;loop&quot; id&#x3D;&quot;audios&amp;">
<meta property="og:type" content="article">
<meta property="og:title" content="前端+后端知识汇总（1）">
<meta property="og:url" content="http://example.com/posts/7ee65b9f.html">
<meta property="og:site_name" content="晚夜微雨问海棠のBlog">
<meta property="og:description" content="前言: 在学项目课的时候，三个目的： 1.学习自学能力 2.学习调 bug 的能力 3.学习分析解决问题的能力  背景音乐 外链式音乐，网易云音乐网址的 ID 复制过来即可  例如:&lt;送你一朵小红花：1804797118&gt; 1234&lt;audio autoplay&#x3D;&quot;autopaly&quot; loop&#x3D;&quot;loop&quot; id&#x3D;&quot;audios&amp;">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://img1.baidu.com/it/u=2163263263,2058666557&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=497">
<meta property="article:published_time" content="2022-11-12T03:28:51.703Z">
<meta property="article:modified_time" content="2022-12-06T08:01:38.252Z">
<meta property="article:author" content="晚夜微雨问海棠">
<meta property="article:tag" content="杂七杂八">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://img1.baidu.com/it/u=2163263263,2058666557&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=497"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="http://example.com/posts/7ee65b9f"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//fonts.googleapis.com" crossorigin=""/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="manifest" href="/manifest.json"/><meta name="msapplication-TileColor" content="#49b1f5"/><link rel="apple-touch-icon" sizes="180x180" href="/img/siteicon/128.png"/><link rel="icon" type="image/png" sizes="32x32" href="/img/siteicon/32.png"/><link rel="icon" type="image/png" sizes="16x16" href="/img/siteicon/16.png"/><link rel="mask-icon" href="/img/siteicon/128.png" color="#5bbad5"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Titillium+Web&amp;display=swap" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"/search.xml","preload":false,"languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"简"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":150},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: true,
    post: true
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: {"limitCount":650,"languages":{"author":"作者: 晚夜微雨问海棠","link":"链接: ","source":"来源: 晚夜微雨问海棠のBlog","info":"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},
  lightbox: 'fancybox',
  Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#1f1f1f","position":"top-right"},
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: true,
  isAnchor: true
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '前端+后端知识汇总（1）',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2022-12-06 16:01:38'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><link rel="stylesheet" href="/css/custom.css" media="defer" onload="this.media='all'"> <link rel="stylesheet" href="/swiper/swiper.min.css"> <link rel="stylesheet" href="/swiper/swiperstyle.css"> <link rel="stylesheet" href="/css/rightMenu.css"> <link rel="stylesheet" href="/css/constrain.css"><!-- hexo injector head_end start --><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper/swiper-bundle.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-card-history/baiduhistory/css/main.css"><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-categories-card@1.0.0/lib/categorybar.css"><link rel="stylesheet" href="https://cdn.cbd.int/hexo-butterfly-clock-anzhiyu/lib/clock.min.css" /><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-double-row-display@1.00/cardlistpost.min.css"/>
<style>#recent-posts > .recent-post-item >.recent-post-info > .article-meta-wrap > .tags:before {content:"\A";
  white-space: pre;}#recent-posts > .recent-post-item >.recent-post-info > .article-meta-wrap > .tags > .article-meta__separator{display:none}</style>
<link rel="stylesheet" href="https://cdn.cbd.int/anzhiyu-blog@2.0.3/css/runtime/runtime.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.cbd.int/hexo-butterfly-swiper-anzhiyu@1.0.4/lib/swiper.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.cbd.int/hexo-butterfly-swiper-anzhiyu@1.0.4/lib/swiperstyle.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.cbd.int/hexo-butterfly-wowjs/lib/animate.min.css" media="print" onload="this.media='screen'"><link rel="stylesheet" href="https://cdn.cbd.int/hexo-butterfly-tag-plugins-plus@latest/lib/assets/font-awesome-animation.min.css" media="defer" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.cbd.int/hexo-butterfly-tag-plugins-plus@latest/lib/tag_plugins.css" media="defer" onload="this.media='all'"><script src="https://cdn.cbd.int/hexo-butterfly-tag-plugins-plus@latest/lib/assets/carousel-touch.js"></script><!-- hexo injector head_end end --><meta name="generator" content="Hexo 6.2.0"><link rel="alternate" href="/atom.xml" title="晚夜微雨问海棠のBlog" type="application/atom+xml">
</head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><div id="web_bg" style="background:url(https://img1.baidu.com/it/u=2163263263,2058666557&amp;fm=253&amp;fmt=auto&amp;app=138&amp;f=JPEG?w=500&amp;h=497);background-attachment: local;background-position: center;background-size: cover;background-repeat: no-repeat;"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src= "" data-lazy-src="https://img2.woyaogexing.com/2022/06/28/de1ce3dc65468fd4!400x400.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">97</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">31</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">17</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/bangumis/index.html"><i class="fa-fw fas fa-home"></i><span> 追番</span></a></div><div class="menus_item"><a class="site-page" href="/comments/"><i class="fa-fw fas fa-envelope"></i><span> 留言板</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 生活馆</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" target="_blank" rel="noopener" href="http://81.69.189.243:8082/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友情链接</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://img1.baidu.com/it/u=2163263263,2058666557&amp;fm=253&amp;fmt=auto&amp;app=138&amp;f=JPEG?w=500&amp;h=497')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">晚夜微雨问海棠のBlog</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/bangumis/index.html"><i class="fa-fw fas fa-home"></i><span> 追番</span></a></div><div class="menus_item"><a class="site-page" href="/comments/"><i class="fa-fw fas fa-envelope"></i><span> 留言板</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 生活馆</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" target="_blank" rel="noopener" href="http://81.69.189.243:8082/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友情链接</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">前端+后端知识汇总（1）</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2022-11-12T03:28:51.703Z" title="发表于 2022-11-12 11:28:51">2022-11-12</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2022-12-06T08:01:38.252Z" title="更新于 2022-12-06 16:01:38">2022-12-06</time></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">12.1k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>54分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="前端+后端知识汇总（1）"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h2 id="前言"><a href="#前言" class="headerlink" title="前言:"></a>前言:</h2><blockquote>
<p>在学项目课的时候，三个目的：</p>
<p>1.学习自学能力</p>
<p>2.学习调 bug 的能力</p>
<p>3.学习分析解决问题的能力</p>
</blockquote>
<h2 id="背景音乐"><a href="#背景音乐" class="headerlink" title="背景音乐"></a>背景音乐</h2><ul>
<li><p>外链式音乐，网易云音乐网址的 ID 复制过来即可</p>
</li>
<li><p>例如:&lt;送你一朵小红花：1804797118&gt;</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">audio</span> <span class="attr">autoplay</span>=<span class="string">&quot;autopaly&quot;</span> <span class="attr">loop</span>=<span class="string">&quot;loop&quot;</span> <span class="attr">id</span>=<span class="string">&quot;audios&quot;</span> <span class="attr">preload</span>=<span class="string">&quot;auto&quot;</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">source</span> <span class="attr">src</span>=<span class="string">&quot;http://music.163.com/song/media/outer/url?id=1299550093.mp3&quot;</span> <span class="attr">type</span>=<span class="string">&quot;audio/mp3&quot;</span> /&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">audio</span>&gt;</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>
</li>
</ul>
<h2 id="SQL-server"><a href="#SQL-server" class="headerlink" title="SQL server"></a>SQL server</h2><h3 id="事务"><a href="#事务" class="headerlink" title="事务"></a>事务</h3><ul>
<li>启动事务： begin tran</li>
<li>事务回滚：rollback tran</li>
<li>提交事务: commit tran</li>
<li>书签: save tran</li>
</ul>
<h3 id="触发器"><a href="#触发器" class="headerlink" title="触发器"></a>触发器</h3><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br></pre></td><td class="code"><pre><span class="line"> <span class="keyword">AS</span></span><br><span class="line">  T<span class="operator">-</span><span class="keyword">SQL</span>语句</span><br><span class="line">GO</span><br><span class="line"><span class="comment">--with encryption 表示加密触发器定义的sql文本</span></span><br><span class="line"><span class="comment">--delete,insert,update指定触发器的类型</span></span><br><span class="line"></span><br><span class="line"><span class="number">2.</span>创建添加触发器</span><br><span class="line"><span class="comment">--创建insert触发器</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">trigger</span> trig_insert</span><br><span class="line"><span class="keyword">on</span> student</span><br><span class="line">after <span class="keyword">insert</span></span><br><span class="line"><span class="keyword">as</span></span><br><span class="line"><span class="keyword">begin</span></span><br><span class="line">    if object_id(N<span class="string">&#x27;student_sum&#x27;</span>,N<span class="string">&#x27;U&#x27;</span>) <span class="keyword">is</span> <span class="keyword">null</span><span class="comment">--判断student_sum表是否存在</span></span><br><span class="line">        <span class="keyword">create</span> <span class="keyword">table</span> student_sum(stuCount <span class="type">int</span> <span class="keyword">default</span>(<span class="number">0</span>));<span class="comment">--创建存储学生人数的student_sum表</span></span><br><span class="line">    <span class="keyword">declare</span> <span class="variable">@stuNumber</span> <span class="type">int</span>;</span><br><span class="line">    <span class="keyword">select</span> <span class="variable">@stuNumber</span> <span class="operator">=</span> <span class="built_in">count</span>(<span class="operator">*</span>)<span class="keyword">from</span> student;</span><br><span class="line">    if <span class="keyword">not</span> <span class="keyword">exists</span> (<span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> student_sum)<span class="comment">--判断表中是否有记录</span></span><br><span class="line">        <span class="keyword">insert</span> <span class="keyword">into</span> student_sum <span class="keyword">values</span>(<span class="number">0</span>);</span><br><span class="line">    <span class="keyword">update</span> student_sum <span class="keyword">set</span> stuCount <span class="operator">=</span><span class="variable">@stuNumber</span>; <span class="comment">--把更新后总的学生数插入到student_sum表中</span></span><br><span class="line"><span class="keyword">end</span></span><br><span class="line"></span><br><span class="line"><span class="number">3.</span>禁止向该表插入数据</span><br><span class="line"><span class="comment">--创建insert_forbidden,禁止用户向student_sum表中插入数据</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">trigger</span> insert_forbidden</span><br><span class="line"><span class="keyword">on</span> student_sum</span><br><span class="line">after <span class="keyword">insert</span></span><br><span class="line"><span class="keyword">as</span></span><br><span class="line"><span class="keyword">begin</span></span><br><span class="line">    RAISERROR(<span class="string">&#x27;禁止直接向该表中插入记录，操作被禁止&#x27;</span>,<span class="number">1</span>,<span class="number">1</span>)<span class="comment">--raiserror 是用于抛出一个错误</span></span><br><span class="line"><span class="keyword">rollback</span> transaction</span><br><span class="line"><span class="keyword">end</span></span><br><span class="line"></span><br><span class="line"><span class="number">4.</span>创建删除触发器、</span><br><span class="line"><span class="comment">--创建delete触发器</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">trigger</span> trig_delete</span><br><span class="line"><span class="keyword">on</span> student</span><br><span class="line">after <span class="keyword">delete</span></span><br><span class="line"><span class="keyword">as</span></span><br><span class="line"><span class="keyword">begin</span></span><br><span class="line">    <span class="keyword">select</span> stu_id <span class="keyword">as</span> 已删除的学生编号,stu_name stu_gender,stu_age</span><br><span class="line">    <span class="keyword">from</span> deleted</span><br><span class="line"><span class="keyword">end</span>;</span><br><span class="line"></span><br><span class="line"><span class="number">5.</span>创建修改触发器</span><br><span class="line"><span class="comment">--创建update触发器</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">trigger</span> trig_update</span><br><span class="line"><span class="keyword">on</span> student</span><br><span class="line">after <span class="keyword">update</span></span><br><span class="line"><span class="keyword">as</span></span><br><span class="line"><span class="keyword">begin</span></span><br><span class="line">    <span class="keyword">declare</span> <span class="variable">@stuCount</span> <span class="type">int</span>;</span><br><span class="line">    <span class="keyword">select</span> <span class="variable">@stuCount</span><span class="operator">=</span><span class="built_in">count</span>(<span class="operator">*</span>) <span class="keyword">from</span> student;</span><br><span class="line">    <span class="keyword">update</span> student_sum <span class="keyword">set</span> stuCount <span class="operator">=</span><span class="variable">@stuCount</span>;</span><br><span class="line">    <span class="keyword">select</span> stu_id <span class="keyword">as</span> 更新前学生编号,stu_name <span class="keyword">as</span> 更新前学生姓名 <span class="keyword">from</span> deleted</span><br><span class="line">    <span class="keyword">select</span> stu_id <span class="keyword">as</span> 更新后学生编号,stu_name <span class="keyword">as</span> 更新后学生姓名 <span class="keyword">from</span> inserted</span><br><span class="line"><span class="keyword">end</span></span><br><span class="line"></span><br><span class="line"><span class="number">6.</span>创建替代触发器</span><br><span class="line"><span class="comment">--创建instead of 触发器</span></span><br><span class="line"><span class="keyword">create</span> <span class="keyword">trigger</span> trig_insteadOf</span><br><span class="line"><span class="keyword">on</span> student</span><br><span class="line">instead <span class="keyword">of</span> <span class="keyword">insert</span></span><br><span class="line"><span class="keyword">as</span></span><br><span class="line"><span class="keyword">begin</span></span><br><span class="line">    <span class="keyword">declare</span> <span class="variable">@stuAge</span> <span class="type">int</span>;</span><br><span class="line">    <span class="keyword">select</span> <span class="variable">@stuAge</span><span class="operator">=</span>(<span class="keyword">select</span> stu_age <span class="keyword">from</span> inserted)</span><br><span class="line">if(<span class="variable">@stuAge</span> <span class="operator">&gt;</span><span class="number">120</span>)</span><br><span class="line">    <span class="keyword">select</span> <span class="string">&#x27;插入年龄错误&#x27;</span> <span class="keyword">as</span> <span class="string">&#x27;失败原因&#x27;</span></span><br><span class="line"><span class="keyword">end</span></span><br></pre></td></tr></table></figure>
<h2 id="Javascript"><a href="#Javascript" class="headerlink" title="Javascript"></a>Javascript</h2><h3 id="二级菜单"><a href="#二级菜单" class="headerlink" title="二级菜单"></a>二级菜单</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"> $(<span class="keyword">function</span>(<span class="params"></span>) &#123;</span><br><span class="line"><span class="comment">// 2. 事件切换 hover  如果只写一个函数，那么鼠标经过和鼠标离开都会触发这个函数</span></span><br><span class="line">            $(<span class="string">&quot;.nav&gt;li&quot;</span>).<span class="title function_">hover</span>(<span class="keyword">function</span>(<span class="params"></span>) &#123;</span><br><span class="line">                <span class="comment">// stop 方法必须写到动画的前面</span></span><br><span class="line">                $(<span class="variable language_">this</span>).<span class="title function_">children</span>(<span class="string">&quot;ul&quot;</span>).<span class="title function_">stop</span>().<span class="title function_">slideToggle</span>();</span><br><span class="line">&#125;);</span><br></pre></td></tr></table></figure>
<h3 id="过滤-filter-的使用"><a href="#过滤-filter-的使用" class="headerlink" title="过滤 filter 的使用"></a>过滤 <code>filter</code> 的使用</h3><ul>
<li><p>题目：根据 ID 进行删除</p>
</li>
<li><p>数组中，如果当前循环项的 ID 不等于 原来的 ID，就把 item项过滤出来，放到一个新的数组中，<br>filter走完以后就不包含要删的哪一项了</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="variable language_">this</span>.<span class="property">list</span>.<span class="title function_">filter</span>(<span class="function"><span class="params">item</span> =&gt;</span> item.<span class="property">id</span> !== id)</span><br></pre></td></tr></table></figure>
</li>
</ul>
<h3 id="puth-用法"><a href="#puth-用法" class="headerlink" title="puth 用法"></a>puth 用法</h3><ul>
<li><p>push() 方法可向数组的末尾添加一个或多个元素，并返回新的长度。</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> obj = &#123;</span><br><span class="line">                       <span class="attr">id</span>: <span class="variable language_">this</span>.<span class="property">nextid</span>,          <span class="comment">// id</span></span><br><span class="line">                       <span class="attr">name</span>: <span class="variable language_">this</span>.<span class="property">brand</span>,   <span class="comment">// 品牌</span></span><br><span class="line">                       <span class="attr">status</span>: <span class="literal">true</span>,           <span class="comment">// 状态</span></span><br><span class="line">                       <span class="attr">time</span>: <span class="keyword">new</span> <span class="title class_">Date</span>     <span class="comment">// 创建的时间</span></span><br><span class="line">                   &#125;</span><br><span class="line"><span class="comment">// 接收值</span></span><br><span class="line"><span class="variable language_">this</span>.<span class="property">list</span>.<span class="title function_">push</span>(obj)</span><br></pre></td></tr></table></figure>
</li>
</ul>
<h3 id="截取字符串"><a href="#截取字符串" class="headerlink" title="截取字符串"></a>截取字符串</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">  <span class="comment">// 字符串有 charAt(0) 方法,这个方法接收索引值，表示从字符串中吧索引对应的字符，获取出来</span></span><br><span class="line"> <span class="comment">// toUpperCase(),转成大写</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">const</span> f =val.<span class="title function_">charAt</span>(<span class="number">0</span>).<span class="title function_">toUpperCase</span>()</span><br><span class="line"></span><br><span class="line">    <span class="comment">// 字符串的 slice(1) 方法,可以截取字符串，从指定索引往后截取</span></span><br><span class="line">                    <span class="keyword">const</span> other = val.<span class="title function_">slice</span>(<span class="number">1</span>)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">// 过滤器函数，必须被定义到 filters 节点之下</span></span><br><span class="line">            <span class="comment">// 过滤器本身是函数</span></span><br><span class="line"></span><br><span class="line">            <span class="attr">filters</span>: &#123;</span><br><span class="line">                <span class="comment">// 注意：过滤器函数形参中的 val ，永远都是&quot;管道符&quot;前面的那个值</span></span><br><span class="line">                <span class="title class_">Caph</span>(val) &#123;</span><br><span class="line">                    <span class="comment">// 字符串有 charAt(0) 方法,这个方法接收索引值，表示从字符串中吧索引对应的字符，获取出来</span></span><br><span class="line">                    val.<span class="title function_">charAt</span>(<span class="number">0</span>)</span><br><span class="line">                        <span class="comment">// 过滤器中一定要有一个返回值 return</span></span><br><span class="line">                    <span class="keyword">return</span> <span class="string">&#x27;abc&#x27;</span></span><br><span class="line">                &#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h3 id="模板对象"><a href="#模板对象" class="headerlink" title="模板对象"></a>模板对象</h3><p> <em><!-- `` 返单引号是一 模板对象 --></em></p>
<h2 id="ASP-Net-WebForm"><a href="#ASP-Net-WebForm" class="headerlink" title="ASP.Net WebForm"></a>ASP.Net WebForm</h2><h3 id="session-传值用法"><a href="#session-传值用法" class="headerlink" title="session 传值用法"></a>session 传值用法</h3><figure class="highlight c#"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">页面<span class="number">1</span></span><br><span class="line">Session[<span class="string">&quot;name&quot;</span>] = Label.Text;</span><br><span class="line"></span><br><span class="line">页面<span class="number">2</span></span><br><span class="line"><span class="built_in">string</span> name;</span><br><span class="line">　　name = Session[<span class="string">&quot;name&quot;</span>].ToString();</span><br><span class="line"></span><br><span class="line">注意:</span><br><span class="line">session不用时可以销毁它，销毁的方法是：清除一个：Session.Remove(<span class="string">&quot;session名&quot;</span>);</span><br><span class="line"></span><br><span class="line">　　　　　　　　　　　　　　　　　清除所有：Session.Clear();</span><br></pre></td></tr></table></figure>
<h3 id="frameset的属性及用法"><a href="#frameset的属性及用法" class="headerlink" title="frameset的属性及用法"></a>frameset的属性及用法</h3><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br></pre></td><td class="code"><pre><span class="line">一、frameset</span><br><span class="line">1. 属性</span><br><span class="line"></span><br><span class="line">①border</span><br><span class="line"></span><br><span class="line">设置框架的边框粗细。</span><br><span class="line">②bordercolor</span><br><span class="line">设置框架的边框颜色。</span><br><span class="line">③frameborder</span><br><span class="line">设置是否显示框架边框。设定值只有0、1；0 表示不要边框，1 表示要显示边框。</span><br><span class="line">④cols</span><br><span class="line">纵向分割页面。其数值表示方法有三种：“30%、30（或者30px）、*”；数值的个数代表分成的视窗数目且数值之间用“,”隔开。“30%”表示该框架区域占全部浏览器页面区域的30%；“30”表示该区域横向宽度为30像素；“*”表示该区域占用余下页面空间。例如：cols=&quot;25%,200,*&quot; 表示将页面分为三部分，左面部分占页面30%，中间横向宽度为200像素，页面余下的作为右面部分。</span><br><span class="line">⑤rows</span><br><span class="line">横向分割页面。数值表示方法与意义与cols相同。</span><br><span class="line">⑥framespacing</span><br><span class="line">设置框架与框架间的保留的空白距离。</span><br><span class="line">2. 用例</span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">frameset</span> <span class="attr">cols</span>=<span class="string">&quot;213,*&quot;</span> <span class="attr">frameborder</span>=<span class="string">&quot;no&quot;</span> <span class="attr">border</span>=<span class="string">&quot;0&quot;</span> <span class="attr">framespacing</span>=<span class="string">&quot;0&quot;</span>&gt;</span></span><br><span class="line">注意1：</span><br><span class="line">cols与rows两属性尽量不要同在一个<span class="tag">&lt;<span class="name">frameset</span>&gt;</span>标签中使用。若要实现下图架构，代码正确写法为：</span><br><span class="line">Frameset使用教程</span><br><span class="line">1 <span class="tag">&lt;<span class="name">frameset</span> <span class="attr">rows</span>=<span class="string">&quot;59,*&quot;</span> <span class="attr">cols</span>=<span class="string">&quot;*&quot;</span> <span class="attr">frameborder</span>=<span class="string">&quot;no&quot;</span> <span class="attr">border</span>=<span class="string">&quot;0&quot;</span> <span class="attr">framespacing</span>=<span class="string">&quot;0&quot;</span>&gt;</span></span><br><span class="line">2   <span class="tag">&lt;<span class="name">frame</span> <span class="attr">src</span>=<span class="string">&quot;???&quot;</span> <span class="attr">name</span>=<span class="string">&quot;topFrame&quot;</span> <span class="attr">scrolling</span>=<span class="string">&quot;No&quot;</span> <span class="attr">noresize</span>=<span class="string">&quot;noresize&quot;</span> <span class="attr">id</span>=<span class="string">&quot;topFrame&quot;</span>/&gt;</span></span><br><span class="line">3   <span class="tag">&lt;<span class="name">frameset</span> <span class="attr">cols</span>=<span class="string">&quot;213,*&quot;</span> <span class="attr">frameborder</span>=<span class="string">&quot;no&quot;</span> <span class="attr">border</span>=<span class="string">&quot;0&quot;</span> <span class="attr">framespacing</span>=<span class="string">&quot;0&quot;</span>&gt;</span></span><br><span class="line">4     <span class="tag">&lt;<span class="name">frame</span> <span class="attr">src</span>=<span class="string">&quot;???&quot;</span> <span class="attr">name</span>=<span class="string">&quot;leftFrame&quot;</span> <span class="attr">scrolling</span>=<span class="string">&quot;No&quot;</span> <span class="attr">noresize</span>=<span class="string">&quot;noresize&quot;</span> <span class="attr">id</span>=<span class="string">&quot;leftFrame&quot;</span>/&gt;</span></span><br><span class="line">5     <span class="tag">&lt;<span class="name">frame</span> <span class="attr">src</span>=<span class="string">&quot;???&quot;</span> <span class="attr">name</span>=<span class="string">&quot;mainFrame&quot;</span> <span class="attr">id</span>=<span class="string">&quot;mainFrame&quot;</span>/&gt;</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">【即，若想即使用cols又使用rows，可利用frameset嵌套实现】</span><br><span class="line">注意2：</span><br><span class="line"><span class="tag">&lt;<span class="name">frameset</span> <span class="attr">cols</span>=<span class="string">&quot;40%,*,*&quot;</span>&gt;</span></span><br><span class="line">意思是：第一个框架占整个浏览器窗口的40%,剩下的空间平均分配给另外两个框架。</span><br><span class="line"><span class="tag">&lt;<span class="name">frameset</span> <span class="attr">cols</span>=<span class="string">&quot;*,*,*,*&quot;</span>&gt;</span></span><br><span class="line">意思是：浏览器窗口等分为四部分。</span><br><span class="line"></span><br><span class="line">二、frame</span><br><span class="line">1. 属性</span><br><span class="line">①name</span><br><span class="line">设置框架名称。此为必须设置的属性。</span><br><span class="line">②src</span><br><span class="line">设置此框架要显示的网页名称或路径。此为必须设置的属性。</span><br><span class="line">③scrolling</span><br><span class="line">设置是否要显示滚动条。设定值为auto, yes, no。</span><br><span class="line">④bordercolor</span><br><span class="line">设置框架的边框颜色。</span><br><span class="line">⑤frameborder</span><br><span class="line">设置是否显示框架边框。设定值只有0、1；0 表示不要边框，1 表示要显示边框。</span><br><span class="line">⑥noresize</span><br><span class="line">设置框架大小是否能手动调节。</span><br><span class="line">⑦marginwidth</span><br><span class="line">设置框架边界和其中内容之间的宽度。</span><br><span class="line">⑧marginhight</span><br><span class="line">设置框架边界和其中内容之间的高度。</span><br><span class="line">⑨width</span><br><span class="line">设置框架宽度。</span><br><span class="line">⑩height</span><br><span class="line">设置框架高度。</span><br><span class="line">2. 用例</span><br><span class="line"><span class="tag">&lt;<span class="name">frame</span> <span class="attr">src</span>=<span class="string">&quot;???&quot;</span> <span class="attr">name</span>=<span class="string">&quot;topFrame&quot;</span> <span class="attr">scrolling</span>=<span class="string">&quot;No&quot;</span> <span class="attr">noresize</span>=<span class="string">&quot;noresize&quot;</span> <span class="attr">marginwidth</span>=<span class="string">&quot;10&quot;</span> <span class="attr">marginhight</span>=<span class="string">&quot;10&quot;</span> <span class="attr">width</span>=<span class="string">&quot;400&quot;</span> <span class="attr">height</span>=<span class="string">&quot;800&quot;</span> /&gt;</span></span><br><span class="line">三、iframe</span><br><span class="line">是浮动的框架（frame），其常用属性与frame类似，其他的主要有以下（相同的就不列举了）</span><br><span class="line">1. 属性</span><br><span class="line">①align</span><br><span class="line">设置垂直或水平对齐方式</span><br><span class="line">②allowTransparency</span><br><span class="line">设置或获取对象是否可为透明。</span><br><span class="line">2. 用例</span><br><span class="line"><span class="tag">&lt;<span class="name">iframe</span> <span class="attr">name</span>=<span class="string">&quot;123&quot;</span> <span class="attr">align</span>=<span class="string">&quot;middle&quot;</span> <span class="attr">marginwidth</span>=<span class="string">&quot;0&quot;</span> <span class="attr">marginheight</span>=<span class="string">0</span> <span class="attr">src</span>=<span class="string">&quot;???&quot;</span> <span class="attr">frameborder</span>=<span class="string">&quot;0&quot;</span> <span class="attr">scrolling</span>=<span class="string">&quot;no&quot;</span> <span class="attr">width</span>=<span class="string">&quot;776&quot;</span> <span class="attr">height</span>=<span class="string">&quot;2500&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">iframe</span>&gt;</span></span><br><span class="line">注意：</span><br><span class="line">iframe标签与frameset、frame标签的验证方法不同，是XHTML 1.0 Transitional。且iframe是放在body标签之内，而frameset、frame是放在body标签之外。</span><br><span class="line"></span><br><span class="line">四、综合示例</span><br><span class="line">复制代码</span><br><span class="line"> 1 <span class="tag">&lt;<span class="name">html</span>&gt;</span></span><br><span class="line"> 2 <span class="tag">&lt;<span class="name">head</span>&gt;</span></span><br><span class="line"> 3 <span class="tag">&lt;<span class="name">title</span>&gt;</span>综合示例<span class="tag">&lt;/<span class="name">title</span>&gt;</span></span><br><span class="line"> 4 <span class="tag">&lt;/<span class="name">head</span>&gt;</span></span><br><span class="line"> 5 <span class="tag">&lt;<span class="name">frameset</span> <span class="attr">cols</span>=<span class="string">&quot;25%,*&quot;</span>&gt;</span></span><br><span class="line"> 6 <span class="tag">&lt;<span class="name">frame</span> <span class="attr">src</span>=<span class="string">&quot;menu.html&quot;</span> <span class="attr">scrolling</span>=<span class="string">&quot;no&quot;</span> <span class="attr">name</span>=<span class="string">&quot;Left&quot;</span>&gt;</span></span><br><span class="line"> 7 <span class="tag">&lt;<span class="name">frame</span> <span class="attr">src</span>=<span class="string">&quot;page1.html&quot;</span> <span class="attr">scrolling</span>=<span class="string">&quot;auto&quot;</span> <span class="attr">name</span>=<span class="string">&quot;Main&quot;</span>&gt;</span></span><br><span class="line"> 8 <span class="tag">&lt;<span class="name">noframes</span>&gt;</span></span><br><span class="line"> 9 <span class="tag">&lt;<span class="name">body</span>&gt;</span></span><br><span class="line">10 <span class="tag">&lt;<span class="name">p</span>&gt;</span>对不起，您的浏览器不支持“框架”！<span class="tag">&lt;/<span class="name">p</span>&gt;</span></span><br><span class="line">11 <span class="tag">&lt;/<span class="name">body</span>&gt;</span></span><br><span class="line">12 <span class="tag">&lt;/<span class="name">noframes</span>&gt;</span></span><br><span class="line">13 <span class="tag">&lt;/<span class="name">frameset</span>&gt;</span></span><br><span class="line">14 <span class="tag">&lt;/<span class="name">html</span>&gt;</span></span><br><span class="line">复制代码</span><br><span class="line">复制代码</span><br><span class="line">1 <span class="tag">&lt;<span class="name">html</span>&gt;</span></span><br><span class="line">2 <span class="tag">&lt;<span class="name">head</span>&gt;</span></span><br><span class="line">3 <span class="tag">&lt;<span class="name">title</span>&gt;</span>menu<span class="tag">&lt;/<span class="name">title</span>&gt;</span></span><br><span class="line">4 <span class="tag">&lt;/<span class="name">head</span>&gt;</span></span><br><span class="line">5 <span class="tag">&lt;<span class="name">body</span>&gt;</span></span><br><span class="line">6 <span class="tag">&lt;<span class="name">a</span> <span class="attr">href</span>=<span class="string">&quot;page1.html&quot;</span>  <span class="attr">target</span>=<span class="string">&quot;Main&quot;</span>&gt;</span>内容1<span class="tag">&lt;/<span class="name">a</span>&gt;</span></span><br><span class="line">7 <span class="tag">&lt;<span class="name">a</span> <span class="attr">href</span>=<span class="string">&quot;page2.html&quot;</span>  <span class="attr">target</span>=<span class="string">&quot;Main&quot;</span>&gt;</span>内容2<span class="tag">&lt;/<span class="name">a</span>&gt;</span></span><br><span class="line">8 <span class="tag">&lt;/<span class="name">body</span>&gt;</span></span><br><span class="line">9 <span class="tag">&lt;/<span class="name">html</span>&gt;</span></span><br><span class="line">复制代码</span><br><span class="line"></span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h3 id="frameset"><a href="#frameset" class="headerlink" title="frameset"></a>frameset</h3><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">head</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">head</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">frameset</span> <span class="attr">rows</span>=<span class="string">&quot;100,*&quot;</span> <span class="attr">cols</span>=<span class="string">&quot;*&quot;</span> <span class="attr">scrolling</span>=<span class="string">&quot;No&quot;</span> <span class="attr">framespacing</span>=<span class="string">&quot;0&quot;</span> <span class="attr">frameborder</span>=<span class="string">&quot;no&quot;</span> <span class="attr">border</span>=<span class="string">&quot;0&quot;</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">frameset</span> <span class="attr">rows</span>=<span class="string">&quot;100,*&quot;</span> <span class="attr">cols</span>=<span class="string">&quot;*&quot;</span> <span class="attr">scrolling</span>=<span class="string">&quot;No&quot;</span> <span class="attr">framespacing</span>=<span class="string">&quot;0&quot;</span> <span class="attr">frameborder</span>=<span class="string">&quot;no&quot;</span> <span class="attr">border</span>=<span class="string">&quot;0&quot;</span>&gt;</span></span><br><span class="line"> 		<span class="tag">&lt;<span class="name">frame</span> <span class="attr">src</span>=<span class="string">&quot;head.aspx&quot;</span> <span class="attr">name</span>=<span class="string">&quot;headmenu&quot;</span> <span class="attr">id</span>=<span class="string">&quot;mainFrame&quot;</span> <span class="attr">title</span>=<span class="string">&quot;mainFrame&quot;</span>&gt;</span><span class="comment">&lt;!-- 引用头部 --&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">frameset</span>&gt;</span></span><br><span class="line">	<span class="comment">&lt;!-- 引用左边和主体部分 --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">frameset</span> <span class="attr">rows</span>=<span class="string">&quot;100*&quot;</span> <span class="attr">cols</span>=<span class="string">&quot;220,*&quot;</span> <span class="attr">scrolling</span>=<span class="string">&quot;No&quot;</span> <span class="attr">framespacing</span>=<span class="string">&quot;0&quot;</span> <span class="attr">frameborder</span>=<span class="string">&quot;no&quot;</span> <span class="attr">border</span>=<span class="string">&quot;0&quot;</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">frame</span> <span class="attr">src</span>=<span class="string">&quot;left.aspx&quot;</span> <span class="attr">name</span>=<span class="string">&quot;leftmenu&quot;</span> <span class="attr">scrolling</span>=<span class="string">&quot;NO&quot;</span> <span class="attr">noresize</span>=<span class="string">&quot;noresize&quot;</span> <span class="attr">id</span>=<span class="string">&quot;mainFrame&quot;</span> <span class="attr">title</span>=<span class="string">&quot;mainFrame&quot;</span>&gt;</span></span><br><span class="line">		《在右边显示是 链接的name=&#x27;main&#x27;》</span><br><span class="line">		《<span class="tag">&lt;<span class="name">td</span>&gt;</span><span class="tag">&lt;<span class="name">a</span> <span class="attr">href</span>=<span class="string">&quot;../insert.aspx&quot;</span> <span class="attr">target</span>=<span class="string">&quot;main&quot;</span>&gt;</span>网站首页<span class="tag">&lt;/<span class="name">a</span>&gt;</span><span class="tag">&lt;/<span class="name">td</span>&gt;</span>》</span><br><span class="line">		<span class="tag">&lt;<span class="name">frame</span> <span class="attr">src</span>=<span class="string">&quot;right.aspx&quot;</span> <span class="attr">name</span>=<span class="string">&quot;main&quot;</span> <span class="attr">scrolling</span>=<span class="string">&quot;yes&quot;</span> <span class="attr">noresize</span>=<span class="string">&quot;noresize&quot;</span> <span class="attr">id</span>=<span class="string">&quot;rightFrame&quot;</span> <span class="attr">title</span>=<span class="string">&quot;rightFrame&quot;</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">frameset</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">frameset</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">noframes</span>&gt;</span><span class="tag">&lt;/<span class="name">noframes</span>&gt;</span></span><br></pre></td></tr></table></figure>
<h3 id="Equals-是否相等"><a href="#Equals-是否相等" class="headerlink" title="Equals 是否相等"></a>Equals 是否相等</h3><ul>
<li><p>确定此实例是否与指定的对象（也必须是string对象）具有相同的值</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">  if (mi.Equals(this.TextBox4.Text) == false)</span><br><span class="line"><span class="comment">&lt;!-- 意思是判断mi的值是否与this.textbox.text的值相等==false也就是不相等--&gt;</span></span><br></pre></td></tr></table></figure>
</li>
</ul>
<h3 id="获取复选框的值"><a href="#获取复选框的值" class="headerlink" title="获取复选框的值"></a>获取复选框的值</h3><ul>
<li>若复选框有多个，就将复选框放进一个容器里面，茹Panel里面<br>，将panle遍历循环，获取谁被选中了，checked</li>
</ul>
<h3 id="动态显示当前系统时间"><a href="#动态显示当前系统时间" class="headerlink" title="动态显示当前系统时间"></a>动态显示当前系统时间</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">&lt;script type=<span class="string">&quot;text/javascript&quot;</span>&gt;</span><br><span class="line">            <span class="comment">//得到时间并写入div</span></span><br><span class="line">            <span class="keyword">function</span> <span class="title function_">getDate</span>(<span class="params"></span>) &#123;</span><br><span class="line">                    <span class="comment">//获取当前时间</span></span><br><span class="line">                    <span class="keyword">var</span> date = <span class="keyword">new</span> <span class="title class_">Date</span>();</span><br><span class="line">                    <span class="comment">//格式化为本地时间格式</span></span><br><span class="line">                    <span class="keyword">var</span> date1 = date.<span class="title function_">toLocaleString</span>();</span><br><span class="line">                    <span class="comment">//获取div</span></span><br><span class="line">                <span class="keyword">var</span> div1 = <span class="variable language_">document</span>.<span class="title function_">getElementById</span>(<span class="string">&quot;Label2&quot;</span>);</span><br><span class="line">                    <span class="comment">//将时间写入div</span></span><br><span class="line">                    div1.<span class="property">innerHTML</span> = date1;</span><br><span class="line"></span><br><span class="line">    &#125;</span><br><span class="line">                 <span class="comment">//使用定时器每秒向div写入当前时间</span></span><br><span class="line">                 <span class="built_in">setInterval</span>(<span class="string">&quot;getDate()&quot;</span>, <span class="number">1000</span>);</span><br><span class="line">&lt;/script&gt;</span><br></pre></td></tr></table></figure>
<h3 id="关闭当前网页"><a href="#关闭当前网页" class="headerlink" title="关闭当前网页"></a>关闭当前网页</h3><figure class="highlight c#"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">Response.Write(<span class="string">&quot;&lt;script&gt;window.opener=null;window.close();&lt;/script&gt;&quot;</span>);<span class="comment">// 不会弹出询问</span></span><br></pre></td></tr></table></figure>
<h3 id="12306中遇到的问题"><a href="#12306中遇到的问题" class="headerlink" title="12306中遇到的问题"></a>12306中遇到的问题</h3><ul>
<li><p>题目:点击添加，判断数据表中是否有数据，若有，则修改数量，若无，则执行添加操作</p>
</li>
<li><p>完成状态:</p>
<pre><code>点击添加，判断数据表中是否有数据，若有，则终止操作，修改数量的功能没有实现
</code></pre><p>若无可执行添加操作</p>
</li>
<li><p>难点:若有数据，则终止操作 ok ，</p>
<pre><code>修改数量的功能没有实现
</code></pre><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">if <span class="keyword">exists</span>(<span class="keyword">select</span> <span class="operator">*</span> <span class="keyword">from</span> sysobjects <span class="keyword">where</span> name<span class="operator">=</span><span class="string">&#x27;retreat_num&#x27;</span>)</span><br><span class="line">	<span class="keyword">drop</span> <span class="keyword">trigger</span> retreat_num</span><br><span class="line">go</span><br><span class="line"><span class="keyword">create</span> <span class="keyword">trigger</span> retreat_num</span><br><span class="line"><span class="keyword">on</span> retreat</span><br><span class="line">after <span class="keyword">insert</span>,<span class="keyword">update</span>,<span class="keyword">delete</span></span><br><span class="line"><span class="keyword">as</span></span><br><span class="line"><span class="keyword">declare</span> <span class="variable">@danhao</span> nvarchar(<span class="number">50</span>)</span><br><span class="line"><span class="keyword">declare</span> <span class="variable">@num</span> <span class="type">int</span></span><br><span class="line"><span class="keyword">declare</span> <span class="variable">@name</span> nvarchar(<span class="number">50</span>)</span><br><span class="line"><span class="keyword">select</span> <span class="variable">@danhao</span><span class="operator">=</span>retreat_danhao ,<span class="variable">@num</span><span class="operator">=</span>retreat_num ,<span class="variable">@name</span><span class="operator">=</span>retreat_name <span class="keyword">from</span> inserted</span><br><span class="line"></span><br><span class="line">if ((<span class="keyword">select</span> <span class="built_in">count</span>(<span class="operator">*</span>) <span class="keyword">from</span> retreat <span class="keyword">where</span> retreat_name<span class="operator">=</span><span class="variable">@name</span>)<span class="operator">&gt;</span><span class="number">1</span>)</span><br><span class="line"><span class="keyword">begin</span></span><br><span class="line"><span class="keyword">update</span> retreat <span class="keyword">set</span> retreat_num<span class="operator">+</span><span class="operator">=</span><span class="number">1</span>  <span class="keyword">where</span> retreat_danhao<span class="operator">=</span><span class="variable">@danhao</span></span><br><span class="line"><span class="keyword">rollback</span></span><br><span class="line"><span class="keyword">end</span></span><br><span class="line"><span class="keyword">else</span></span><br><span class="line"><span class="keyword">begin</span></span><br><span class="line">print(<span class="string">&#x27;插入成功&#x27;</span>)</span><br><span class="line"><span class="keyword">end</span></span><br></pre></td></tr></table></figure>
</li>
</ul>
<h3 id="隐藏控件"><a href="#隐藏控件" class="headerlink" title="隐藏控件"></a>隐藏控件</h3><ul>
<li>隐藏控件Visible=”false”</li>
</ul>
<h3 id="验证控件"><a href="#验证控件" class="headerlink" title="验证控件"></a>验证控件</h3><blockquote>
<p>RequiredFieldValidtor：必须验证字段</p>
<p>CompareValidator：比较验证</p>
<p>RangeValidator：范围验证</p>
<p>RegularExpressionValidator：正则表达式验证</p>
<p>CustomValidator：自定义验证</p>
<p> ValidationSummary：验证总结</p>
</blockquote>
<h3 id="跳转页面的几种方法"><a href="#跳转页面的几种方法" class="headerlink" title="跳转页面的几种方法"></a>跳转页面的几种方法</h3><figure class="highlight c#"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">1.</span>最常用的页面跳转（原窗口被替代）：Response.Redirect(<span class="string">&quot;XXX.aspx&quot;</span>);</span><br><span class="line"></span><br><span class="line"><span class="number">2.</span>利用url地址打开本地网页或互联网：Respose.Write(<span class="string">&quot;&lt;script language=&#x27;javascript&#x27;&gt;window.open(&#x27;&quot;</span>+ url+<span class="string">&quot;&#x27;);&lt;/script&gt;&quot;</span>);</span><br><span class="line"></span><br><span class="line"><span class="number">3.</span>原窗口保留再新打开另一个页面（浏览器可能阻止，需要解除）：Response.Write(<span class="string">&quot;&lt;script&gt;window.open(&#x27;XXX.aspx&#x27;,&#x27;_blank&#x27;)&lt;/script&gt;&quot;</span>);</span><br><span class="line"></span><br><span class="line"><span class="number">4.</span>效果同<span class="number">1</span>中的另一种写法：Response.Write(<span class="string">&quot;&lt;script&gt;window.location=&#x27;XXX.aspx&#x27;&lt;/script&gt;&quot;</span>);</span><br><span class="line"></span><br><span class="line"><span class="number">5.</span>也是原窗口被替代的 （常用于传递session变量的页面跳转）：Server.Transfer(<span class="string">&quot;XXX.aspx&quot;</span>);</span><br><span class="line"></span><br><span class="line"><span class="number">6.</span>原窗口保留，以对话框形式打开新窗口：Response.Write(<span class="string">&quot;&lt;script&gt;window.showModelessDialog(&#x27;XXX.aspx&#x27;)&lt;/script&gt;&quot;</span>);</span><br><span class="line"></span><br><span class="line"><span class="number">7.</span>对话框形式打开新窗口，原窗口被代替：Response.Write(<span class="string">&quot;&lt;script&gt;window.showModelDialog(&#x27;XXX.aspx&#x27;)&lt;/script&gt;&quot;</span>);</span><br><span class="line"></span><br><span class="line"><span class="number">8.</span>打开简洁窗口：Respose.Write(<span class="string">&quot;&lt;script language=&#x27;javascript&#x27;&gt;window.open(&#x27;&quot;</span>+url+<span class="string">&quot;&#x27;,&#x27;&#x27;,&#x27;resizable=1,scrollbars=0,status=1,menubar=no,toolbar=no,location=no, menu=no&#x27;);&lt;/script&gt;&quot;</span>);</span><br><span class="line"></span><br><span class="line"><span class="number">9.</span>利用vs2008端口：System.Diagnostics.Process.Start(http:<span class="comment">//localhost:3210/系统管理员.aspx);</span></span><br></pre></td></tr></table></figure>
<h3 id="提示并跳转"><a href="#提示并跳转" class="headerlink" title="提示并跳转"></a>提示并跳转</h3><figure class="highlight c#"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ClientScript.RegisterStartupScript(<span class="keyword">this</span>.GetType(), <span class="string">&quot;js&quot;</span>, <span class="string">&quot;&lt;script&gt;alert(&#x27;修改成功&#x27;);window.location.href=&#x27;login.aspx&#x27;;&lt;/script&gt;&quot;</span>);</span><br></pre></td></tr></table></figure>
<h3 id="上传图片"><a href="#上传图片" class="headerlink" title="上传图片"></a>上传图片</h3><figure class="highlight c#"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 方法一、</span></span><br><span class="line"><span class="keyword">if</span>(img.HasFile)</span><br><span class="line">&#123;</span><br><span class="line">	<span class="built_in">string</span> filename=DateTime.Now.Tostring()+DateTime.Now.Month.Tostring()+Path.GetExtension(img.FileName);</span><br><span class="line">	<span class="built_in">string</span> filepath=<span class="string">&quot;~/img/&quot;</span>+filename;</span><br><span class="line">	img.SaveAs(MapPath(filepath));</span><br><span class="line">	goods.img=filename;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">// 方法二 、</span></span><br><span class="line"><span class="keyword">if</span> (FileUpload1.HasFile)</span><br><span class="line">            &#123;</span><br><span class="line">                <span class="comment">//获取文件名</span></span><br><span class="line">                <span class="built_in">string</span> name = FileUpload1.FileName;</span><br><span class="line">                <span class="comment">//截取字符串</span></span><br><span class="line">                <span class="built_in">string</span> str = FileUpload1.FileName.Substring(name.LastIndexOf(<span class="string">&#x27;.&#x27;</span>) + <span class="number">1</span>);</span><br><span class="line">                <span class="comment">//判断格  式</span></span><br><span class="line">                <span class="keyword">if</span> (str == <span class="string">&quot;jpg&quot;</span> || str == <span class="string">&quot;png&quot;</span>)</span><br><span class="line">                &#123;</span><br><span class="line">                    <span class="comment">//上传成功</span></span><br><span class="line">                    FileUpload1.SaveAs(Server.MapPath(<span class="string">&quot;/img/&quot;</span>)+name);</span><br><span class="line">                    Image1.ImageUrl = <span class="string">&quot;/img/&quot;</span> + name;</span><br><span class="line">                    Label1.Text = <span class="string">&quot;上传成功&quot;</span>;</span><br><span class="line">                &#125;</span><br><span class="line">                <span class="keyword">else</span></span><br><span class="line">                &#123;</span><br><span class="line">                    Label1.Text = <span class="string">&quot;格式有误&quot;</span>;</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">            <span class="keyword">else</span></span><br><span class="line">            &#123;</span><br><span class="line">                Label1.Text = <span class="string">&quot;请选择文件&quot;</span>;</span><br><span class="line">            &#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h3 id="将-div当成提示框显示"><a href="#将-div当成提示框显示" class="headerlink" title="将 div当成提示框显示"></a>将 div当成提示框显示</h3><blockquote>
<p>使用jQuery控制div的弹出框效果:<br>地址:<br><a target="_blank" rel="noopener" href="http://www.manongjc.com/detail/17-vskpycybmbxxkmz.html">http://www.manongjc.com/detail/17-vskpycybmbxxkmz.html</a></p>
<p>个人理解:<br>加载时div显示，点击确定，让div隐藏<br>style.display=”nono”<br>使用javascript弹出窗口,再使用ajax将弹出窗口的选中项填充中主页面的textbox中.从而实现无postback提交.</p>
</blockquote>
<h3 id="返回顶部"><a href="#返回顶部" class="headerlink" title="返回顶部"></a>返回顶部</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line">&lt;script type=<span class="string">&quot;text/javascript&quot;</span>&gt;</span><br><span class="line">       <span class="comment">//返回顶部</span></span><br><span class="line">       $(<span class="keyword">function</span> (<span class="params"></span>) &#123;</span><br><span class="line">           $(<span class="variable language_">window</span>).<span class="title function_">scroll</span>(<span class="keyword">function</span> (<span class="params"></span>) &#123;  <span class="comment">//只要窗口滚动,就触发下面代码</span></span><br><span class="line">               <span class="keyword">var</span> scrollt = <span class="variable language_">document</span>.<span class="property">documentElement</span>.<span class="property">scrollTop</span> + <span class="variable language_">document</span>.<span class="property">body</span>.<span class="property">scrollTop</span>; <span class="comment">//获取滚动后的高度</span></span><br><span class="line">               <span class="keyword">if</span> (scrollt &gt; <span class="number">200</span>) &#123;  <span class="comment">//判断滚动后高度超过200px,就显示</span></span><br><span class="line">                   $(<span class="string">&quot;#back_top&quot;</span>).<span class="title function_">fadeIn</span>(<span class="number">400</span>); <span class="comment">//淡出</span></span><br><span class="line">               &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">                   $(<span class="string">&quot;#back_top&quot;</span>).<span class="title function_">stop</span>().<span class="title function_">fadeOut</span>(<span class="number">400</span>); <span class="comment">//如果返回或者没有超过,就淡入.必须加上stop()停止之前动画,否则会出现闪动</span></span><br><span class="line">               &#125;</span><br><span class="line">           &#125;);</span><br><span class="line">           $(<span class="string">&quot;#back_top&quot;</span>).<span class="title function_">click</span>(<span class="keyword">function</span> (<span class="params"></span>) &#123; <span class="comment">//当点击标签的时候,使用animate在200毫秒的时间内,滚到顶部</span></span><br><span class="line">               $(<span class="string">&quot;html,body&quot;</span>).<span class="title function_">animate</span>(&#123; <span class="attr">scrollTop</span>: <span class="string">&quot;0px&quot;</span> &#125;, <span class="number">200</span>);</span><br><span class="line">           &#125;);</span><br><span class="line">       &#125;);</span><br><span class="line">       <span class="comment">//将出发日期的值赋值给返程日期</span></span><br><span class="line">       $(<span class="keyword">function</span> (<span class="params"></span>) &#123;</span><br><span class="line">           $(<span class="string">&quot;#TextBox6&quot;</span>).<span class="title function_">change</span>(<span class="keyword">function</span> (<span class="params"></span>) &#123;</span><br><span class="line">               <span class="keyword">if</span> ($(<span class="variable language_">this</span>).<span class="title function_">val</span>() == <span class="string">&quot;&quot;</span>) &#123;</span><br><span class="line">                   $(<span class="string">&quot;#TextBox4&quot;</span>).<span class="title function_">val</span>(<span class="string">&quot;&quot;</span>);</span><br><span class="line">               &#125;</span><br><span class="line">               <span class="keyword">else</span> &#123;</span><br><span class="line">                   $(<span class="string">&quot;#TextBox7&quot;</span>).<span class="title function_">val</span>($(<span class="variable language_">this</span>).<span class="title function_">val</span>());</span><br><span class="line">               &#125;</span><br><span class="line">           &#125;)</span><br><span class="line">       &#125;)</span><br><span class="line">   &lt;/script&gt;</span><br></pre></td></tr></table></figure>
<h3 id="显示与隐藏"><a href="#显示与隐藏" class="headerlink" title="显示与隐藏"></a>显示与隐藏</h3><ul>
<li><p>javascript</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//车票</span></span><br><span class="line">  <span class="comment">// ff1,超链接的id</span></span><br><span class="line">  <span class="comment">// cc1，要显示的 div 的 ID</span></span><br><span class="line">  <span class="keyword">var</span> ff1 = <span class="variable language_">document</span>.<span class="title function_">getElementById</span>(<span class="string">&#x27;ff1&#x27;</span>);</span><br><span class="line">  <span class="keyword">var</span> cc1 = <span class="variable language_">document</span>.<span class="title function_">getElementById</span>(<span class="string">&#x27;search-main-item&#x27;</span>);</span><br><span class="line">  ff1.<span class="property">onclick</span> = <span class="keyword">function</span> (<span class="params"></span>) &#123;</span><br><span class="line">      <span class="comment">//显示第一个，隐藏二三</span></span><br><span class="line">      cc1.<span class="property">style</span>.<span class="property">display</span> = <span class="string">&quot;block&quot;</span>;</span><br><span class="line">      cc2.<span class="property">style</span>.<span class="property">display</span> = <span class="string">&quot;none&quot;</span>;</span><br><span class="line">      cc3.<span class="property">style</span>.<span class="property">display</span> = <span class="string">&quot;none&quot;</span>;</span><br><span class="line"></span><br><span class="line">      <span class="comment">//给当前的父级，也就是小li，追加active类</span></span><br><span class="line">      <span class="comment">//车票（追加类）</span></span><br><span class="line">      $(<span class="variable language_">this</span>).<span class="title function_">parent</span>().<span class="title function_">addClass</span>(<span class="string">&quot;active&quot;</span>);</span><br><span class="line">      <span class="comment">//常用查询（删除类）</span></span><br><span class="line">      $(<span class="string">&quot;#ff2&quot;</span>).<span class="title function_">parent</span>().<span class="title function_">removeClass</span>(<span class="string">&quot;active&quot;</span>);</span><br><span class="line">      <span class="comment">//订餐（删除类）</span></span><br><span class="line">      $(<span class="string">&quot;#ff3&quot;</span>).<span class="title function_">parent</span>().<span class="title function_">removeClass</span>(<span class="string">&quot;active&quot;</span>);</span><br><span class="line">  &#125;</span><br></pre></td></tr></table></figure>
</li>
</ul>
<h3 id="轮播图"><a href="#轮播图" class="headerlink" title="轮播图"></a>轮播图</h3><ul>
<li><p>javascript</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">&lt;script type=<span class="string">&quot;text/javascript&quot;</span>&gt;</span><br><span class="line">       <span class="comment">//返回顶部</span></span><br><span class="line">       $(<span class="keyword">function</span> (<span class="params"></span>) &#123;</span><br><span class="line">           $(<span class="variable language_">window</span>).<span class="title function_">scroll</span>(<span class="keyword">function</span> (<span class="params"></span>) &#123;  <span class="comment">//只要窗口滚动,就触发下面代码</span></span><br><span class="line">               <span class="keyword">var</span> scrollt = <span class="variable language_">document</span>.<span class="property">documentElement</span>.<span class="property">scrollTop</span> + <span class="variable language_">document</span>.<span class="property">body</span>.<span class="property">scrollTop</span>; <span class="comment">//获取滚动后的高度</span></span><br><span class="line">               <span class="keyword">if</span> (scrollt &gt; <span class="number">200</span>) &#123;  <span class="comment">//判断滚动后高度超过200px,就显示</span></span><br><span class="line">                   $(<span class="string">&quot;#back_top&quot;</span>).<span class="title function_">fadeIn</span>(<span class="number">400</span>); <span class="comment">//淡出</span></span><br><span class="line">               &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">                   $(<span class="string">&quot;#back_top&quot;</span>).<span class="title function_">stop</span>().<span class="title function_">fadeOut</span>(<span class="number">400</span>); <span class="comment">//如果返回或者没有超过,就淡入.必须加上stop()停止之前动画,否则会出现闪动</span></span><br><span class="line">               &#125;</span><br><span class="line">           &#125;);</span><br><span class="line">           $(<span class="string">&quot;#back_top&quot;</span>).<span class="title function_">click</span>(<span class="keyword">function</span> (<span class="params"></span>) &#123; <span class="comment">//当点击标签的时候,使用animate在200毫秒的时间内,滚到顶部</span></span><br><span class="line">               $(<span class="string">&quot;html,body&quot;</span>).<span class="title function_">animate</span>(&#123; <span class="attr">scrollTop</span>: <span class="string">&quot;0px&quot;</span> &#125;, <span class="number">200</span>);</span><br><span class="line">           &#125;);</span><br><span class="line">       &#125;);</span><br><span class="line">   &lt;/script&gt;</span><br></pre></td></tr></table></figure>
</li>
</ul>
<ul>
<li>html</li>
</ul>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">&lt;%--轮播图--%&gt;</span><br><span class="line">         <span class="tag">&lt;<span class="name">div</span> <span class="attr">id</span>=<span class="string">&quot;imgs&quot;</span>&gt;</span></span><br><span class="line">             <span class="tag">&lt;<span class="name">img</span> <span class="attr">src</span>=<span class="string">&quot;img/ia_200000055(1).jpg&quot;</span> /&gt;</span></span><br><span class="line">             <span class="tag">&lt;<span class="name">img</span> <span class="attr">src</span>=<span class="string">&quot;img/ia_200000056(1).jpg&quot;</span> /&gt;</span></span><br><span class="line">             <span class="tag">&lt;<span class="name">img</span> <span class="attr">src</span>=<span class="string">&quot;img/ia_200000057(1).jpg&quot;</span> /&gt;</span></span><br><span class="line">             <span class="tag">&lt;<span class="name">img</span> <span class="attr">src</span>=<span class="string">&quot;img/ia_200000058(1).jpg&quot;</span> /&gt;</span></span><br><span class="line">             <span class="tag">&lt;<span class="name">img</span> <span class="attr">src</span>=<span class="string">&quot;img/ia_200000059(1).jpg&quot;</span> /&gt;</span></span><br><span class="line">         <span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br></pre></td></tr></table></figure>
<h3 id="两个文本框同步"><a href="#两个文本框同步" class="headerlink" title="两个文本框同步"></a>两个文本框同步</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//将出发日期的值赋值给返程日期</span></span><br><span class="line">   $(<span class="keyword">function</span> (<span class="params"></span>) &#123;</span><br><span class="line">       $(<span class="string">&quot;#TextBox6&quot;</span>).<span class="title function_">change</span>(<span class="keyword">function</span> (<span class="params"></span>) &#123;</span><br><span class="line">           <span class="keyword">if</span> ($(<span class="variable language_">this</span>).<span class="title function_">val</span>() == <span class="string">&quot;&quot;</span>) &#123;</span><br><span class="line">               $(<span class="string">&quot;#TextBox4&quot;</span>).<span class="title function_">val</span>(<span class="string">&quot;&quot;</span>);</span><br><span class="line">           &#125;</span><br><span class="line">           <span class="keyword">else</span> &#123;</span><br><span class="line">               $(<span class="string">&quot;#TextBox7&quot;</span>).<span class="title function_">val</span>($(<span class="variable language_">this</span>).<span class="title function_">val</span>());</span><br><span class="line">           &#125;</span><br><span class="line">       &#125;)</span><br><span class="line">   &#125;)</span><br></pre></td></tr></table></figure>
<h3 id="时间"><a href="#时间" class="headerlink" title="时间"></a>时间</h3><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//得到时间并写入div</span></span><br><span class="line"><span class="keyword">function</span> <span class="title function_">getDate</span>(<span class="params"></span>) &#123;</span><br><span class="line">    <span class="comment">//获取当前时间</span></span><br><span class="line">    <span class="keyword">var</span> date = <span class="keyword">new</span> <span class="title class_">Date</span>();</span><br><span class="line">    <span class="comment">//格式化为本地时间格式</span></span><br><span class="line">    <span class="keyword">var</span> date1 = date.<span class="title function_">toLocaleString</span>();</span><br><span class="line">    <span class="comment">//获取div</span></span><br><span class="line">    <span class="keyword">var</span> div1 = <span class="variable language_">document</span>.<span class="title function_">getElementById</span>(<span class="string">&quot;Label2&quot;</span>);</span><br><span class="line">    <span class="comment">//将时间写入div</span></span><br><span class="line">    div1.<span class="property">innerHTML</span> = date1;</span><br><span class="line">&#125;</span><br><span class="line"><span class="comment">//使用定时器每秒向div写入当前时间</span></span><br><span class="line"><span class="built_in">setInterval</span>(<span class="string">&quot;getDate()&quot;</span>, <span class="number">1000</span>);</span><br></pre></td></tr></table></figure>
<h3 id="根据-id-查询数据，并将查询出来的数据赋值给-控件"><a href="#根据-id-查询数据，并将查询出来的数据赋值给-控件" class="headerlink" title="根据 id 查询数据，并将查询出来的数据赋值给 控件"></a>根据 id 查询数据，并将查询出来的数据赋值给 控件</h3><ol>
<li><p>实例：</p>
</li>
<li><p>```c#<br> //接受传进来的ID<br>int playid = int.Parse(Request[“playid”]);<br> //1.先实例化<br>Playbll p = new Playbll();<br>DataTable bp = p.selectid(playid);<br>TextBox1.Text = bp.Rows[0][“PlayName”].ToString();<br>//下拉框<br>Bindsel();<br>TextBox4.Text = bp.Rows[0][“PlayRole”].ToString();<br>//单选<br>string aaa = bp.Rows[0][“PlayArea”].ToString();</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">3.</span><br><span class="line"></span><br><span class="line">4.</span><br><span class="line"></span><br><span class="line">## html/css</span><br><span class="line"></span><br><span class="line">### 字体间距</span><br><span class="line"></span><br><span class="line">```css</span><br><span class="line">/* 字间距写法 */</span><br><span class="line">.text &#123;</span><br><span class="line">  color: #000;</span><br><span class="line">  font-size: 30px;</span><br><span class="line">  /* 字间距 */</span><br><span class="line">  letter-spacing: 15px;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">  /* 字间距 */</span><br><span class="line">  letter-spacing: 15px;</span><br></pre></td></tr></table></figure>
</li>
</ol>
<h3 id="渐变背景"><a href="#渐变背景" class="headerlink" title="渐变背景"></a>渐变背景</h3><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*背景开始*/</span></span><br><span class="line">       <span class="selector-tag">body</span>&#123;</span><br><span class="line">           <span class="attribute">margin</span>: <span class="number">0</span>;</span><br><span class="line">           <span class="attribute">padding</span>: <span class="number">0</span>;</span><br><span class="line">           <span class="attribute">height</span>: <span class="number">100vh</span>;</span><br><span class="line">           <span class="attribute">display</span>: flex;</span><br><span class="line">           <span class="attribute">justify-content</span>: center;</span><br><span class="line">           <span class="attribute">background</span>: <span class="built_in">linear-gradient</span>(</span><br><span class="line">           <span class="number">120deg</span>,</span><br><span class="line">           <span class="number">#2c3e50</span>,</span><br><span class="line">           <span class="number">#27ae60</span>,</span><br><span class="line">           <span class="number">#2980b9</span>,</span><br><span class="line">           <span class="number">#e74c3c</span>,</span><br><span class="line">           <span class="number">#8e44ad</span>,</span><br><span class="line">           <span class="number">#eb9e5f</span>,</span><br><span class="line">           <span class="number">#e4db61</span>,</span><br><span class="line">           <span class="number">#b5dd58</span>,</span><br><span class="line">           <span class="number">#74da66</span>,</span><br><span class="line">           <span class="number">#56d0d6</span>,</span><br><span class="line">           <span class="number">#508cdf</span>,</span><br><span class="line">           <span class="number">#8a62d4</span>,</span><br><span class="line">           <span class="number">#c667dd</span>,</span><br><span class="line">           <span class="number">#a83a94</span>,</span><br><span class="line">           <span class="number">#da64a3</span>,</span><br><span class="line">           <span class="number">#b43f5d</span>,</span><br><span class="line">           <span class="number">#d65151</span></span><br><span class="line">         );</span><br><span class="line">         <span class="comment">/* 指定背景图像的大小 */</span></span><br><span class="line">         <span class="attribute">background-size</span>: <span class="number">500%</span>;</span><br><span class="line">         <span class="comment">/* 执行动画: 动画名 时长 线性的 无限次播放 */</span></span><br><span class="line">         <span class="attribute">animation</span>: donghua <span class="number">80s</span> linear infinite;</span><br><span class="line">       &#125;</span><br><span class="line">       <span class="comment">/* 定义动画 */</span></span><br><span class="line">       <span class="keyword">@keyframes</span> donghua &#123;</span><br><span class="line">         <span class="number">0%</span> &#123;</span><br><span class="line">           <span class="attribute">background-position</span>: <span class="number">0%</span> <span class="number">50%</span>;</span><br><span class="line">         &#125;</span><br><span class="line">         <span class="number">50%</span> &#123;</span><br><span class="line">           <span class="attribute">background-position</span>: <span class="number">100%</span> <span class="number">50%</span>;</span><br><span class="line">         &#125;</span><br><span class="line">         <span class="number">100%</span> &#123;</span><br><span class="line">           <span class="attribute">background-position</span>: <span class="number">0%</span> <span class="number">50%</span>;</span><br><span class="line">         &#125;</span><br><span class="line">       &#125;</span><br><span class="line">      <span class="selector-class">.con</span> &#123;</span><br><span class="line">       <span class="attribute">width</span>: <span class="number">100%</span>;</span><br><span class="line">       <span class="attribute">height</span>: <span class="number">100%</span>;</span><br><span class="line">       <span class="attribute">margin</span>: <span class="number">0</span> auto;</span><br><span class="line">      &#125;</span><br><span class="line">       <span class="comment">/*背景结束*/</span></span><br></pre></td></tr></table></figure>
<h3 id="在最前方显示"><a href="#在最前方显示" class="headerlink" title="在最前方显示"></a>在最前方显示</h3><ol>
<li>z-index：-1到1</li>
</ol>
<h3 id="表单定位问题"><a href="#表单定位问题" class="headerlink" title="表单定位问题"></a>表单定位问题</h3><ol>
<li><p>假如您需要并排放置两个带边框的框，可通过将 box-sizing 设置为 “border-box”。这样就可以让浏览器呈现出带有指定宽度和高度的框，并把边框和内边距放入框中</p>
</li>
<li><p>元素的总高度和宽度包含内边距和边框(padding 与 border) :</p>
</li>
<li><p>```css<br>// 表单<br>.login_form {<br>  position: absolute;<br>  bottom: 0;<br>  width: 100%;<br>  padding: 0 20px;<br>  box-sizing: border-box;<br>}</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">4. 表单定位后，超出表单之上的盒子范围，就可以使用 box-sizing: border-box; 就ok</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">## 结构赋值</span><br><span class="line"></span><br><span class="line">+ 原理:</span><br><span class="line"></span><br><span class="line">  &gt; 一个声明的变量      =    一个大对象&#123;&#125;</span><br><span class="line">  &gt;</span><br><span class="line">  &gt; 可以利用&#123;&#125;从中结构出来想要的属性,最后 打印出来即可</span><br><span class="line"></span><br><span class="line">```xml</span><br><span class="line">const result = await axios(&#123;&#125;)</span><br><span class="line">const &#123;data&#125; = await axios(&#123;&#125;)</span><br><span class="line">console.log(data)</span><br></pre></td></tr></table></figure>
</li>
</ol>
<p>1.</p>
<h2 id="标签内写事件内容"><a href="#标签内写事件内容" class="headerlink" title="标签内写事件内容"></a>标签内写事件内容</h2><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">&lt;!--  注意在只有一行代码的情况下,可以写到里面,效果一样 --&gt;</span></span><br><span class="line">   <span class="tag">&lt;<span class="name">button</span> @<span class="attr">click</span>=<span class="string">&quot;count +=1&quot;</span>&gt;</span>+1<span class="tag">&lt;/<span class="name">button</span>&gt;</span></span><br></pre></td></tr></table></figure>
<h2 id="网页中的-符号"><a href="#网页中的-符号" class="headerlink" title="网页中的 $符号"></a>网页中的 $符号</h2><ol>
<li>在网页中的终端 凡是以 $ 开头的都是 vue 自己挂载上去的对象</li>
</ol>
<h2 id="失去焦点的事件"><a href="#失去焦点的事件" class="headerlink" title="失去焦点的事件"></a>失去焦点的事件</h2><ol>
<li><p>blur  监听失去焦点的事件</p>
</li>
<li><p>实例：</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//监听失去焦点的事件</span></span><br><span class="line">&lt;input type=<span class="string">&quot;text&quot;</span> v-<span class="keyword">if</span>=<span class="string">&quot;inputVisible&quot;</span> @blur=<span class="string">&quot;showbutton&quot;</span>&gt;</span><br><span class="line"><span class="language-xml"><span class="tag">&lt;<span class="name">button</span> <span class="attr">v-else</span> @<span class="attr">click</span>=<span class="string">&quot;showInput&quot;</span>&gt;</span>展示按钮<span class="tag">&lt;/<span class="name">button</span>&gt;</span></span></span><br><span class="line"></span><br><span class="line"><span class="comment">//数据</span></span><br><span class="line"> <span class="title function_">data</span>(<span class="params"></span>) &#123;</span><br><span class="line">    <span class="keyword">return</span> &#123;</span><br><span class="line">      <span class="comment">// 控制输入框和按钮的按需切换</span></span><br><span class="line">      <span class="comment">// 1.默认值为 false ,表示默认展示按钮,隐藏输入框</span></span><br><span class="line">      <span class="attr">inputVisible</span>:<span class="literal">false</span>,</span><br><span class="line">    &#125;</span><br><span class="line">  &#125;,</span><br><span class="line"></span><br><span class="line">      <span class="comment">//函数 方法</span></span><br><span class="line">    <span class="attr">methods</span>: &#123;</span><br><span class="line">      <span class="comment">//2.当文本框失去焦点的时候，让inputVisible等于false就可以显示出 button按钮</span></span><br><span class="line">    <span class="title function_">showbutton</span>(<span class="params"></span>)&#123;</span><br><span class="line">      <span class="variable language_">this</span>.<span class="property">inputVisible</span>=<span class="literal">false</span>;</span><br><span class="line">    &#125;,</span><br><span class="line">       <span class="comment">//3.当点击button按钮的时候，让inputVisible等于true就可以显示文本框</span></span><br><span class="line">    <span class="title function_">showInput</span>(<span class="params"></span>)&#123;</span><br><span class="line">      <span class="variable language_">this</span>.<span class="property">inputVisible</span> = <span class="literal">true</span>;</span><br><span class="line">    &#125;,</span><br><span class="line">  &#125;,</span><br></pre></td></tr></table></figure>
</li>
</ol>
<h2 id="获得焦点的事件"><a href="#获得焦点的事件" class="headerlink" title="获得焦点的事件"></a>获得焦点的事件</h2><ol>
<li><p>focus</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="variable language_">this</span>.$nextTick(<span class="function">() =&gt;</span> &#123;</span><br><span class="line">       <span class="variable language_">this</span>.<span class="property">$refs</span>.<span class="property">iptRef</span>.<span class="title function_">focus</span>()</span><br><span class="line">    &#125;)</span><br></pre></td></tr></table></figure>
</li>
</ol>
<h2 id="数组中的循环"><a href="#数组中的循环" class="headerlink" title="数组中的循环"></a>数组中的循环</h2><blockquote>
<p>结论：</p>
<p>1.foreach 循环一旦开始，便不能停掉，拿到想要的数据之后，还会继续执行</p>
<p>2.使用 some 循环，在找到某个固定的项之后，可以通过 return true 固定的语法，来终止some 循环</p>
<p>3.every 方法，判断数组中,水果是否被全选了!</p>
<p>4.reduce 方法 ，相当于一个累加器</p>
<p>语法：reduce((累加的结果, 当前循环项) =&gt; {}, 初始值) 语法格式</p>
</blockquote>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 1.foreach 循环</span></span><br><span class="line"><span class="keyword">const</span> arr = [<span class="string">&#x27;小红&#x27;</span>, <span class="string">&#x27;倪大红&#x27;</span>, <span class="string">&#x27;苏大强&#x27;</span>, <span class="string">&#x27;宝&#x27;</span>]</span><br><span class="line">        arr.<span class="title function_">forEach</span>(<span class="function">(<span class="params">item, index</span>) =&gt;</span> &#123;</span><br><span class="line">            <span class="comment">// 测试:</span></span><br><span class="line">            <span class="comment">// 如果打印了4次 OK,证明return没作用</span></span><br><span class="line">            <span class="variable language_">console</span>.<span class="title function_">log</span>(<span class="string">&#x27;ok&#x27;</span>);</span><br><span class="line">            <span class="keyword">if</span> (item === <span class="string">&#x27;苏大强&#x27;</span>) &#123;</span><br><span class="line">                <span class="variable language_">console</span>.<span class="title function_">log</span>(index);</span><br><span class="line">                <span class="keyword">return</span></span><br><span class="line">            &#125;</span><br><span class="line">        &#125;)</span><br><span class="line"></span><br><span class="line"><span class="comment">// 2.some 循环</span></span><br><span class="line">arr.<span class="title function_">some</span>(<span class="function">(<span class="params">item,index</span>)=&gt;</span>&#123;</span><br><span class="line">    <span class="keyword">if</span>(item === <span class="string">&#x27;苏大强&#x27;</span>)</span><br><span class="line">    &#123;</span><br><span class="line">        <span class="keyword">return</span> <span class="literal">true</span></span><br><span class="line">    &#125;</span><br><span class="line">&#125;)</span><br><span class="line"></span><br><span class="line"><span class="comment">// 3.every 方法</span></span><br><span class="line">&lt;script&gt;</span><br><span class="line">        <span class="keyword">const</span> arr = [</span><br><span class="line">            &#123;<span class="attr">id</span>: <span class="number">1</span>,<span class="attr">name</span>: <span class="string">&#x27;西瓜&#x27;</span>,<span class="attr">state</span>: <span class="literal">true</span>,&#125;,</span><br><span class="line">            &#123;<span class="attr">id</span>: <span class="number">2</span>,<span class="attr">name</span>: <span class="string">&#x27;榴莲&#x27;</span>,<span class="attr">state</span>: <span class="literal">true</span>,&#125;,</span><br><span class="line">            &#123;<span class="attr">id</span>: <span class="number">3</span>,<span class="attr">name</span>: <span class="string">&#x27;草莓&#x27;</span>,<span class="attr">state</span>: <span class="literal">true</span>,&#125;,</span><br><span class="line">        ];</span><br><span class="line"><span class="keyword">const</span> result = arr.<span class="title function_">every</span>(<span class="function"><span class="params">item</span> =&gt;</span> item.<span class="property">state</span>);</span><br><span class="line">        <span class="variable language_">console</span>.<span class="title function_">log</span>(result);</span><br><span class="line"> &lt;/script&gt;</span><br><span class="line"></span><br><span class="line"><span class="comment">// 4.reduce</span></span><br><span class="line"><span class="comment">// reduce 相当于一个累加器</span></span><br><span class="line"><span class="comment">// reduce((累加的结果, 当前循环项) =&gt; &#123;&#125;, 初始值) 语法格式</span></span><br><span class="line"><span class="comment">// arr.filter(item =&gt; item.state)选中的结果,过滤出来</span></span><br><span class="line">  <span class="keyword">const</span> result = arr</span><br><span class="line">            .<span class="title function_">filter</span>(<span class="function"><span class="params">item</span> =&gt;</span> item.<span class="property">state</span>)</span><br><span class="line">            .<span class="title function_">reduce</span>(<span class="function">(<span class="params">amt, item</span>) =&gt;</span> &#123;</span><br><span class="line"><span class="comment">// 把累加的结果 return 出去,这样第二次循环,amt 的值就不是初始值了,</span></span><br><span class="line">                <span class="keyword">return</span> (amt += item.<span class="property">price</span> * item.<span class="property">count</span>);</span><br><span class="line">            &#125;, <span class="number">0</span>);</span><br><span class="line">        <span class="variable language_">console</span>.<span class="title function_">log</span>(result);</span><br></pre></td></tr></table></figure>
<h2 id="常用的结论，约定"><a href="#常用的结论，约定" class="headerlink" title="常用的结论，约定"></a>常用的结论，约定</h2><blockquote>
<ol>
<li><p>在绑定的时候书写顺序为，先指令，后绑定，最后事件</p>
</li>
<li><p>只要在页面渲染的过程中，只要用到某一份数据，那么这份数据必须被存到data中</p>
</li>
<li><p><template></template>标签只起到一个包裹性的作用，不会被渲染成任何真实的元素</p>
</li>
<li><p>注意：全局声明的过滤器，全局声明的指令、全局XXX，都要放在main.js 文件中</p>
</li>
<li><p><em>当属性名和属性值相同时，可简写为 一个</em></p>
<ul>
<li>例如：router:router</li>
</ul>
</li>
<li><p>Hash地址 和 组件的关系 在路由模块中的 index.js 中声明使用，加一个配置选项，</p>
</li>
<li><p>```js<br>import Home from ‘@/components/Home.vue’<br>import Movie from ‘@/components/Movie.vue’<br>import About from ‘@/components/About.vue’</p>
</li>
</ol>
<p>   // 3.创建 vue 的实例对象<br>   const router = new VueRouter({<br>     // routes 是一个数组，作用：定义 “hash 地址”与 “组件”之间的对应关系<br>     // 如果是 #/xxx ,#必须去掉<br>     // component 要显示的部分<br>     routes:[<br>       {path:’/home’,component:Home},<br>       {path:’/movie’,component:Movie},<br>       {path:’/about’,component:About}<br>     ]<br>   })<br>   <figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">8. *在 vue 中,当安装和配置了 vue-router 后，就可以使用 router-link 来替代普通的 a 链接了*</span><br><span class="line"></span><br><span class="line">9. ```html</span><br><span class="line">    &lt;a href=&quot;#/home&quot;&gt;  首页 &lt;/a&gt;</span><br><span class="line"></span><br><span class="line">     &lt;!-- 可以不写 # ，系统自动展示 # --&gt;</span><br><span class="line"></span><br><span class="line">     &lt;router-link *to*=&quot;/home&quot;&gt;&lt;/router-link&gt;</span><br></pre></td></tr></table></figure></p>
<ol>
<li><p><em><!-- 只要在项目中安装和配置了 vue-router，就可可以使用 router-view这个组件了 --></em></p>
<p>  <em><!-- 它的作用很单纯：占位符 --></em></p>
<p>  <router-view>&lt;/router-view&gt;</p>
</li>
<li><p>子路由规则不要以 / 开头，也就是说在 children 属性下，不要以 / 开头</p>
</li>
<li><p>```js<br>{</p>
<pre><code>  path:&#39;/about&#39;,
  component:About,
  // 重定向
  redirect: &#39;/about/tab1&#39;,  // 重定向:重新指向其它path,会改变网址
  //  子路由规则
  children:[
  &#123;path:&#39;tab1&#39;,component:Tab1&#125;,
  &#123;path:&#39;tab2&#39;,component:Tab2&#125;,
  ]
&#125;
</code></pre><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">13. *在行内使用编程式导航跳转的时候，this 必须要省略，否则会报错*</span><br><span class="line"></span><br><span class="line">14. 在写 vue 的时候， *: 只能用在路由规则里面*</span><br><span class="line"></span><br><span class="line">15.    ()=&gt;&#123;&#125; 箭头函数 在只有一个参数的时候可省略()</span><br><span class="line"></span><br><span class="line">16.    如果，同时，指定了 prop 和作用域插槽，那么prop指定属性会被 作用域插槽给覆盖掉</span><br><span class="line"></span><br><span class="line">17. 属性中加 router 是开启路由模式</span><br><span class="line"></span><br><span class="line">18. 1</span><br><span class="line"></span><br><span class="line">19. 1</span><br><span class="line"></span><br><span class="line">20. 111</span><br><span class="line"></span><br><span class="line">21. 1</span><br><span class="line"></span><br><span class="line">22. 1</span><br><span class="line"></span><br><span class="line">23. 1</span><br><span class="line"></span><br><span class="line">24. 1</span><br><span class="line"></span><br><span class="line">25.</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">## 快捷键</span><br><span class="line"></span><br><span class="line">### 切换大小写</span><br><span class="line"></span><br><span class="line">1. 一般是按Capslk ，切换大小写，但是这样是不对的</span><br><span class="line">2. 按 Shift 键 输入，便是大写，松开 Shift 键，即小写</span><br><span class="line"></span><br><span class="line">### 快速选中</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">## 组件注册与声明</span><br><span class="line"></span><br><span class="line">1. 当提供了 name 属性之后，组件的名称，就是 name 属性的值</span><br><span class="line"></span><br><span class="line">2. 对比：</span><br><span class="line"></span><br><span class="line">3. &gt; 1.  组件的 “注册名称” 的主要应用场景是：以标签的形式，把注册好的组件，渲染和使用到页面结构之中</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">2. 组件声明时候的 “name” 名称的主要应用场景：结合 &lt;keep-alive&gt; 标签实现组件缓存功能；以及在调试工具中看到组件的 name 名称</span><br><span class="line"></span><br><span class="line">4. 实例:</span><br><span class="line"></span><br><span class="line">5. ```js</span><br><span class="line">  Right 组件</span><br><span class="line">  &lt;script&gt;</span><br><span class="line">  export default &#123;</span><br><span class="line">      name: &#x27;MyRight&#x27;,</span><br><span class="line">  &#125;;</span><br><span class="line">  &lt;/script&gt;</span><br></pre></td></tr></table></figure>
</li>
</ol>
</blockquote>
<h2 id="json-js-配置"><a href="#json-js-配置" class="headerlink" title="json.js 配置"></a>json.js 配置</h2><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 设置字体</span></span><br><span class="line"><span class="string">&quot;editor.fontFamily&quot;</span>: <span class="string">&quot;Consolas&quot;</span></span><br><span class="line"><span class="comment">// vetur configuration</span></span><br><span class="line">  <span class="string">&quot;vetur.format.defaultFormatter.html&quot;</span>: <span class="string">&quot;js-beautify-html&quot;</span>,</span><br><span class="line">  <span class="comment">// 使能每一种语言默认格式化规则</span></span><br><span class="line">  <span class="string">&quot;[html]&quot;</span>: &#123;</span><br><span class="line">    <span class="string">&quot;editor.defaultFormatter&quot;</span>: <span class="string">&quot;esbenp.prettier-vscode&quot;</span></span><br><span class="line">  &#125;,</span><br><span class="line">  <span class="string">&quot;[css]&quot;</span>: &#123;</span><br><span class="line">    <span class="string">&quot;editor.defaultFormatter&quot;</span>: <span class="string">&quot;esbenp.prettier-vscode&quot;</span></span><br><span class="line">  &#125;,</span><br><span class="line">  <span class="string">&quot;[less]&quot;</span>: &#123;</span><br><span class="line">    <span class="string">&quot;editor.defaultFormatter&quot;</span>: <span class="string">&quot;esbenp.prettier-vscode&quot;</span></span><br><span class="line">  &#125;,</span><br><span class="line"></span><br><span class="line">  <span class="comment">/*  prettier的配置 */</span></span><br><span class="line">  <span class="string">&quot;prettier.formatOnSave&quot;</span>: <span class="literal">true</span>, <span class="comment">//保存时自动格式化</span></span><br><span class="line">  <span class="string">&quot;prettier.formatOnPaste&quot;</span>: <span class="literal">true</span>, <span class="comment">//粘贴时自动格式化</span></span><br><span class="line">  <span class="string">&quot;prettier.printWidth&quot;</span>: <span class="number">100</span>, <span class="comment">// 超过最大值换行</span></span><br><span class="line">  <span class="string">&quot;prettier.tabWidth&quot;</span>: <span class="number">2</span>, <span class="comment">// 缩进字节数</span></span><br><span class="line">  <span class="string">&quot;prettier.useTabs&quot;</span>: <span class="literal">false</span>, <span class="comment">// 缩进不使用tab，使用空格</span></span><br><span class="line">  <span class="string">&quot;prettier.semi&quot;</span>: <span class="literal">false</span>, <span class="comment">// 句尾添加分号</span></span><br><span class="line">  <span class="string">&quot;prettier.singleQuote&quot;</span>: <span class="literal">true</span>, <span class="comment">// 使用单引号代替双引号</span></span><br><span class="line">  <span class="comment">//   &quot;prettier.trailingComma&quot;: &quot;es5&quot;, //在对象或数组最后一个元素后面是否加逗号（在ES5中加尾逗号）</span></span><br><span class="line">  <span class="string">&quot;prettier.proseWrap&quot;</span>: <span class="string">&quot;preserve&quot;</span>, <span class="comment">// 默认值。因为使用了一些折行敏感型的渲染器（如GitHub comment）而按照markdown文本样式进行折行</span></span><br><span class="line">  <span class="string">&quot;prettier.arrowParens&quot;</span>: <span class="string">&quot;avoid&quot;</span>, <span class="comment">//  (x) =&gt; &#123;&#125; 箭头函数参数只有一个时是否要有小括号。avoid：省略括号</span></span><br><span class="line">  <span class="string">&quot;prettier.bracketSpacing&quot;</span>: <span class="literal">true</span>, <span class="comment">// 在对象，数组括号与文字之间加空格 &quot;&#123; foo: bar &#125;&quot;</span></span><br><span class="line">  <span class="string">&quot;prettier.endOfLine&quot;</span>: <span class="string">&quot;auto&quot;</span>, <span class="comment">// 结尾是 \n \r \n\r aut</span></span><br><span class="line">  <span class="string">&quot;prettier.eslintIntegration&quot;</span>: <span class="literal">false</span>, <span class="comment">//不让prettier使用eslint的代码格式进行校验</span></span><br><span class="line">  <span class="string">&quot;prettier.htmlWhitespaceSensitivity&quot;</span>: <span class="string">&quot;ignore&quot;</span>,</span><br><span class="line">  <span class="string">&quot;prettier.ignorePath&quot;</span>: <span class="string">&quot;.prettierignore&quot;</span>, <span class="comment">// 不使用prettier格式化的文件填写在项目的.prettierignore文件中</span></span><br><span class="line">  <span class="string">&quot;prettier.jsxBracketSameLine&quot;</span>: <span class="literal">false</span>, <span class="comment">// 在jsx中把&#x27;&gt;&#x27; 是否单独放一行</span></span><br><span class="line">  <span class="string">&quot;prettier.jsxSingleQuote&quot;</span>: <span class="literal">false</span>, <span class="comment">// 在jsx中使用单引号代替双引号</span></span><br><span class="line">  <span class="string">&quot;prettier.parser&quot;</span>: <span class="string">&quot;babylon&quot;</span>, <span class="comment">// 格式化的解析器，默认是babylon</span></span><br><span class="line">  <span class="string">&quot;prettier.requireConfig&quot;</span>: <span class="literal">false</span>, <span class="comment">// Require a &#x27;prettierconfig&#x27; to format prettier</span></span><br><span class="line">  <span class="string">&quot;prettier.requirePragma&quot;</span>: <span class="literal">false</span>, <span class="comment">// 不需要写文件开头的 @prettier</span></span><br><span class="line">  <span class="string">&quot;prettier.useEditorConfig&quot;</span>: <span class="literal">false</span>,</span><br><span class="line">  <span class="string">&quot;prettier.stylelintIntegration&quot;</span>: <span class="literal">false</span>, <span class="comment">//不让prettier使用stylelint的代码格式进行校验</span></span><br><span class="line">  <span class="string">&quot;prettier.tslintIntegration&quot;</span>: <span class="literal">false</span>, <span class="comment">// 不让prettier使用tslint的代码格式进行校验</span></span><br><span class="line"></span><br><span class="line">  <span class="comment">// 自动保存</span></span><br><span class="line">  <span class="comment">//打开文件不覆盖</span></span><br><span class="line">  <span class="string">&quot;workbench.editor.enablePreview&quot;</span>: <span class="literal">false</span>,</span><br><span class="line">  <span class="comment">//关闭快速预览</span></span><br><span class="line">  <span class="string">&quot;editor.minimap.enabled&quot;</span>: <span class="literal">false</span>,</span><br><span class="line">  <span class="comment">//打开自动保存</span></span><br><span class="line">  <span class="string">&quot;files.autoSave&quot;</span>: <span class="string">&quot;afterDelay&quot;</span>,</span><br><span class="line">  <span class="comment">// 头部注释</span></span><br><span class="line">  <span class="string">&quot;fileheader.customMade&quot;</span>: &#123;</span><br><span class="line">    <span class="comment">// &quot;Author&quot;: &quot;yxd&quot;,</span></span><br><span class="line">    <span class="comment">// &quot;Date&quot;: &quot;Do not edit&quot;, // 设置后默认设置文件生成时间</span></span><br><span class="line">    <span class="comment">// &quot;LastEditTime&quot;: &quot;Do not edit&quot;, // 设置后，保存文件更改默认更新最后编辑时间</span></span><br><span class="line">    <span class="comment">// &quot;LastEditors&quot;: &quot;yxd&quot;, // 设置后，保存文件更改默认更新最后编辑人</span></span><br><span class="line">    <span class="comment">// &quot;Description&quot;: &quot;&quot;</span></span><br><span class="line">  &#125;,</span><br><span class="line">  <span class="comment">// 函数注释</span></span><br><span class="line">  <span class="string">&quot;fileheader.cursorMode&quot;</span>: &#123;</span><br><span class="line">    <span class="string">&quot;description&quot;</span>: <span class="string">&quot;&quot;</span>,</span><br><span class="line">    <span class="string">&quot;param&quot;</span>: <span class="string">&quot;&quot;</span>,</span><br><span class="line">    <span class="string">&quot;return&quot;</span>: <span class="string">&quot;&quot;</span></span><br><span class="line">  &#125;,</span><br><span class="line">  <span class="comment">//手机项目rem适配</span></span><br><span class="line">  <span class="string">&quot;px-to-rem.px-per-rem&quot;</span>: <span class="number">100</span>,</span><br><span class="line">  <span class="comment">// -----------------------自动格式化配置eslint+prettier-----------------------</span></span><br><span class="line">  <span class="comment">// 每次保存自动格式化ctrl+s</span></span><br><span class="line">  <span class="string">&quot;editor.formatOnSave&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"></span><br><span class="line">  <span class="comment">//配置内配置对 .vue 文件的格式化</span></span><br><span class="line">  <span class="string">&quot;[vue]&quot;</span>: &#123;</span><br><span class="line">    <span class="string">&quot;editor.defaultFormatter&quot;</span>: <span class="string">&quot;esbenp.prettier-vscode&quot;</span></span><br><span class="line">  &#125;,<span class="variable constant_">SSS</span></span><br><span class="line">  <span class="comment">//配置内配置对 .js 文件的格式化</span></span><br><span class="line">  <span class="string">&quot;[javascript]&quot;</span>: &#123;</span><br><span class="line">    <span class="string">&quot;editor.defaultFormatter&quot;</span>: <span class="string">&quot;HookyQR.beautify&quot;</span></span><br><span class="line">  &#125;,</span><br><span class="line">  <span class="comment">//配置内配置对 .json 文件的格式化</span></span><br><span class="line">  <span class="string">&quot;[jsonc]&quot;</span>: &#123;</span><br><span class="line">    <span class="string">&quot;editor.defaultFormatter&quot;</span>: <span class="string">&quot;esbenp.prettier-vscode&quot;</span></span><br><span class="line">  &#125;,</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">     &#123; <span class="comment">// VScode主题配置</span></span><br><span class="line">  <span class="number">2</span>     <span class="string">&quot;editor.tabSize&quot;</span>: <span class="number">2</span>,</span><br><span class="line">  <span class="number">3</span>     <span class="string">&quot;editor.lineHeight&quot;</span>: <span class="number">24</span>,</span><br><span class="line">  <span class="number">4</span>     <span class="string">&quot;editor.renderLineHighlight&quot;</span>: <span class="string">&quot;none&quot;</span>,</span><br><span class="line">  <span class="number">5</span>     <span class="string">&quot;editor.renderWhitespace&quot;</span>: <span class="string">&quot;none&quot;</span>,</span><br><span class="line">  <span class="number">6</span>     <span class="string">&quot;editor.fontFamily&quot;</span>: <span class="string">&quot;Consolas&quot;</span>,</span><br><span class="line">  <span class="number">7</span>     <span class="string">&quot;editor.fontSize&quot;</span>: <span class="number">15</span>,</span><br><span class="line">  <span class="number">8</span>     <span class="string">&quot;editor.cursorBlinking&quot;</span>: <span class="string">&quot;smooth&quot;</span>,</span><br><span class="line">  <span class="number">9</span>     <span class="string">&quot;editor.multiCursorModifier&quot;</span>: <span class="string">&quot;ctrlCmd&quot;</span>,</span><br><span class="line"> <span class="number">10</span>     <span class="string">&quot;editor.formatOnSave&quot;</span>: <span class="literal">false</span>,</span><br><span class="line"> <span class="number">11</span>     <span class="string">&quot;editor.snippetSuggestions&quot;</span>: <span class="string">&quot;top&quot;</span>,</span><br><span class="line"> <span class="number">12</span>     <span class="string">&quot;editor.wordWrapColumn&quot;</span>: <span class="number">200</span>,</span><br><span class="line"> <span class="number">13</span>     <span class="string">&quot;editor.wordWrap&quot;</span>: <span class="string">&quot;off&quot;</span>,</span><br><span class="line"> <span class="number">14</span>     <span class="string">&quot;editor.quickSuggestions&quot;</span>: &#123;</span><br><span class="line"> <span class="number">15</span>         <span class="string">&quot;other&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="number">16</span>         <span class="string">&quot;comments&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="number">17</span>         <span class="string">&quot;strings&quot;</span>: <span class="literal">false</span></span><br><span class="line"> <span class="number">18</span>     &#125;,</span><br><span class="line"> <span class="number">19</span>     <span class="comment">// 保存时自动格式化</span></span><br><span class="line"> <span class="number">20</span>     <span class="string">&quot;editor.formatOnPaste&quot;</span>: <span class="literal">false</span>,</span><br><span class="line"> <span class="number">21</span>     <span class="string">&quot;files.trimTrailingWhitespace&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="number">22</span>     <span class="string">&quot;terminal.integrated.shell.windows&quot;</span>: <span class="string">&quot;C:\\windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe&quot;</span>,</span><br><span class="line"> <span class="number">23</span>     <span class="string">&quot;typescript.suggest.autoImports&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="number">24</span>     <span class="string">&quot;javascript.updateImportsOnFileMove.enabled&quot;</span>: <span class="string">&quot;always&quot;</span>,</span><br><span class="line"> <span class="number">25</span>     <span class="string">&quot;javascript.suggest.autoImports&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="number">26</span>     <span class="string">&quot;workbench.iconTheme&quot;</span>: <span class="string">&quot;eq-material-theme-icons&quot;</span>,</span><br><span class="line"> <span class="number">27</span>     <span class="string">&quot;workbench.startupEditor&quot;</span>: <span class="string">&quot;newUntitledFile&quot;</span>,</span><br><span class="line"> <span class="number">28</span>     <span class="string">&quot;workbench.colorTheme&quot;</span>: <span class="string">&quot;Material Theme High Contrast&quot;</span>,</span><br><span class="line"> <span class="number">29</span>     <span class="string">&quot;workbench.colorCustomizations&quot;</span>: &#123;</span><br><span class="line"> <span class="number">30</span>         <span class="comment">// 设置guide线高亮颜色</span></span><br><span class="line"> <span class="number">31</span>         <span class="string">&quot;editorIndentGuide.activeBackground&quot;</span>: <span class="string">&quot;#ff0000&quot;</span></span><br><span class="line"> <span class="number">32</span>     &#125;,</span><br><span class="line"> <span class="number">33</span>     <span class="comment">// 启用/禁用导航路径</span></span><br><span class="line"> <span class="number">34</span>     <span class="string">&quot;breadcrumbs.enabled&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="number">35</span>     <span class="comment">// git是否启用自动拉取</span></span><br><span class="line"> <span class="number">36</span>     <span class="string">&quot;git.autofetch&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="number">37</span>     <span class="string">&quot;minapp-vscode.disableAutoConfig&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="number">38</span>     <span class="string">&quot;view-in-browser.customBrowser&quot;</span>: <span class="string">&quot;chrome&quot;</span>,</span><br><span class="line"> <span class="number">39</span>     <span class="comment">// VScode 文件搜索区域配置</span></span><br><span class="line"> <span class="number">40</span>     <span class="string">&quot;search.exclude&quot;</span>: &#123;</span><br><span class="line"> <span class="number">41</span>         <span class="string">&quot;**/dist&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="number">42</span>         <span class="string">&quot;**/build&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="number">43</span>         <span class="string">&quot;**/elehukouben&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="number">44</span>         <span class="string">&quot;**/.git&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="number">45</span>         <span class="string">&quot;**/.gitignore&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="number">46</span>         <span class="string">&quot;**/.svn&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="number">47</span>         <span class="string">&quot;**/.DS_Store&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="number">48</span>         <span class="string">&quot;**/.idea&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="number">49</span>         <span class="string">&quot;**/.vscode&quot;</span>: <span class="literal">false</span>,</span><br><span class="line"> <span class="number">50</span>         <span class="string">&quot;**/yarn.lock&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="number">51</span>         <span class="string">&quot;**/tmp&quot;</span>: <span class="literal">true</span></span><br><span class="line"> <span class="number">52</span>     &#125;,</span><br><span class="line"> <span class="number">53</span>     <span class="comment">// 配置文件关联</span></span><br><span class="line"> <span class="number">54</span>     <span class="string">&quot;files.associations&quot;</span>: &#123;</span><br><span class="line"> <span class="number">55</span>         <span class="string">&quot;*.vue&quot;</span>: <span class="string">&quot;html&quot;</span>,</span><br><span class="line"> <span class="number">56</span>         <span class="string">&quot;*.wxss&quot;</span>: <span class="string">&quot;css&quot;</span>,</span><br><span class="line"> <span class="number">57</span>         <span class="string">&quot;*.cjson&quot;</span>: <span class="string">&quot;jsonc&quot;</span>,</span><br><span class="line"> <span class="number">58</span>         <span class="string">&quot;*.wxs&quot;</span>: <span class="string">&quot;javascript&quot;</span></span><br><span class="line"> <span class="number">59</span>     &#125;,</span><br><span class="line"> <span class="number">60</span>     <span class="comment">// 配置emmet是否启用tab展开缩写</span></span><br><span class="line"> <span class="number">61</span>     <span class="string">&quot;emmet.triggerExpansionOnTab&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"> <span class="number">62</span>     <span class="comment">// 配置emmet对文件类型的支持</span></span><br><span class="line"> <span class="number">63</span>     <span class="string">&quot;emmet.syntaxProfiles&quot;</span>: &#123;</span><br><span class="line"> <span class="number">64</span>         <span class="string">&quot;vue-html&quot;</span>: <span class="string">&quot;html&quot;</span>,</span><br><span class="line"> <span class="number">65</span>         <span class="string">&quot;vue&quot;</span>: <span class="string">&quot;html&quot;</span>,</span><br><span class="line"> <span class="number">66</span>         <span class="string">&quot;javascript&quot;</span>: <span class="string">&quot;javascriptreact&quot;</span>,</span><br><span class="line"> <span class="number">67</span>         <span class="string">&quot;xml&quot;</span>: &#123;</span><br><span class="line"> <span class="number">68</span>             <span class="string">&quot;attr_quotes&quot;</span>: <span class="string">&quot;single&quot;</span></span><br><span class="line"> <span class="number">69</span>         &#125;</span><br><span class="line"> <span class="number">70</span>     &#125;,</span><br><span class="line"> <span class="number">71</span>     <span class="comment">// 在react的jsx中添加对emmet的支持</span></span><br><span class="line"> <span class="number">72</span>     <span class="string">&quot;emmet.includeLanguages&quot;</span>: &#123;</span><br><span class="line"> <span class="number">73</span>         <span class="string">&quot;jsx-sublime-babel-tags&quot;</span>: <span class="string">&quot;javascriptreact&quot;</span>,</span><br><span class="line"> <span class="number">74</span>         <span class="string">&quot;wxml&quot;</span>: <span class="string">&quot;html&quot;</span></span><br><span class="line"> <span class="number">75</span>     &#125;,</span><br><span class="line"> <span class="number">76</span>     <span class="string">&quot;vetur.format.defaultFormatteyr.html&quot;</span>: <span class="string">&quot;js-beautify-html&quot;</span>,</span><br><span class="line"> <span class="number">77</span>     <span class="string">&quot;vetur.format.defaultFormatterOptions&quot;</span>: &#123;</span><br><span class="line"> <span class="number">78</span>         <span class="string">&quot;wrap_attributes&quot;</span>: <span class="string">&quot;force-aligned&quot;</span></span><br><span class="line"> <span class="number">79</span>     &#125;,</span><br><span class="line"> <span class="number">80</span>     <span class="comment">// 是否开启eslint检测</span></span><br><span class="line"> <span class="number">81</span>     <span class="string">&quot;eslint.enable&quot;</span>: <span class="literal">false</span>,</span><br><span class="line"> <span class="number">82</span>     <span class="comment">// 文件保存时，是否自动根据eslint进行格式化</span></span><br><span class="line"> <span class="number">83</span>     <span class="string">&quot;eslint.autoFixOnSave&quot;</span>: <span class="literal">false</span>,</span><br><span class="line"> <span class="number">84</span>     <span class="comment">// eslint配置文件</span></span><br><span class="line"> <span class="number">85</span>     <span class="string">&quot;eslint.options&quot;</span>: &#123;</span><br><span class="line"> <span class="number">86</span>         <span class="string">&quot;configFile&quot;</span>: <span class="string">&quot;E:/aaaworkspace/ex/experience/.eslintrc.js&quot;</span>,</span><br><span class="line"> <span class="number">87</span>         <span class="string">&quot;plugins&quot;</span>: [</span><br><span class="line"> <span class="number">88</span>             <span class="string">&quot;html&quot;</span>,</span><br><span class="line"> <span class="number">89</span>             <span class="string">&quot;vue&quot;</span></span><br><span class="line"> <span class="number">90</span>         ]</span><br><span class="line"> <span class="number">91</span>     &#125;,</span><br><span class="line"> <span class="number">92</span>     <span class="string">&quot;eslint.validate&quot;</span>: [</span><br><span class="line"> <span class="number">93</span>         <span class="string">&quot;javascript&quot;</span>,</span><br><span class="line"> <span class="number">94</span>         <span class="string">&quot;javascriptreact&quot;</span>,</span><br><span class="line"> <span class="number">95</span>         &#123;</span><br><span class="line"> <span class="number">96</span>             <span class="string">&quot;language&quot;</span>: <span class="string">&quot;vue&quot;</span>,</span><br><span class="line"> <span class="number">97</span>             <span class="string">&quot;autoFix&quot;</span>: <span class="literal">true</span></span><br><span class="line"> <span class="number">98</span>         &#125;,</span><br><span class="line"> <span class="number">99</span>         <span class="string">&quot;html&quot;</span>,</span><br><span class="line"><span class="number">100</span>         <span class="string">&quot;typescript&quot;</span>,</span><br><span class="line"><span class="number">101</span>         <span class="string">&quot;typescriptreact&quot;</span></span><br><span class="line"><span class="number">102</span>     ],</span><br><span class="line"><span class="number">103</span>     <span class="comment">// 格式化快捷键 shirt+alt+F</span></span><br><span class="line"><span class="number">104</span>     <span class="comment">// prettier进行格式化时是否安装eslint配置去执行，建议false</span></span><br><span class="line"><span class="number">105</span>     <span class="string">&quot;prettier.eslintIntegration&quot;</span>: <span class="literal">false</span>,</span><br><span class="line"><span class="number">106</span>     <span class="comment">// 如果为true，将使用单引号而不是双引号</span></span><br><span class="line"><span class="number">107</span>     <span class="string">&quot;prettier.singleQuote&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"><span class="number">108</span>     <span class="comment">// 代码换行,每一行最大占有字符数</span></span><br><span class="line"><span class="number">109</span>     <span class="string">&quot;prettier.printWidth&quot;</span>: <span class="number">200</span>,</span><br><span class="line"><span class="number">110</span>     <span class="comment">// 配置gitlen中git提交历史记录的信息显示情况</span></span><br><span class="line"><span class="number">111</span>     <span class="string">&quot;gitlens.advanced.messages&quot;</span>: &#123;</span><br><span class="line"><span class="number">112</span>         <span class="string">&quot;suppressCommitHasNoPreviousCommitWarning&quot;</span>: <span class="literal">false</span>,</span><br><span class="line"><span class="number">113</span>         <span class="string">&quot;suppressCommitNotFoundWarning&quot;</span>: <span class="literal">false</span>,</span><br><span class="line"><span class="number">114</span>         <span class="string">&quot;suppressFileNotUnderSourceControlWarning&quot;</span>: <span class="literal">false</span>,</span><br><span class="line"><span class="number">115</span>         <span class="string">&quot;suppressGitVersionWarning&quot;</span>: <span class="literal">false</span>,</span><br><span class="line"><span class="number">116</span>         <span class="string">&quot;suppressLineUncommittedWarning&quot;</span>: <span class="literal">false</span>,</span><br><span class="line"><span class="number">117</span>         <span class="string">&quot;suppressNoRepositoryWarning&quot;</span>: <span class="literal">false</span>,</span><br><span class="line"><span class="number">118</span>         <span class="string">&quot;suppressResultsExplorerNotice&quot;</span>: <span class="literal">false</span>,</span><br><span class="line"><span class="number">119</span>         <span class="string">&quot;suppressShowKeyBindingsNotice&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"><span class="number">120</span>         <span class="string">&quot;suppressUpdateNotice&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"><span class="number">121</span>         <span class="string">&quot;suppressWelcomeNotice&quot;</span>: <span class="literal">false</span></span><br><span class="line"><span class="number">122</span>     &#125;,</span><br><span class="line"><span class="number">123</span>     <span class="comment">// 调试，本地服务器配置</span></span><br><span class="line"><span class="number">124</span>     <span class="string">&quot;launch&quot;</span>: &#123;</span><br><span class="line"><span class="number">125</span>         <span class="string">&quot;configurations&quot;</span>: [&#123;</span><br><span class="line"><span class="number">126</span>                 <span class="string">&quot;type&quot;</span>: <span class="string">&quot;node&quot;</span>,</span><br><span class="line"><span class="number">127</span>                 <span class="string">&quot;request&quot;</span>: <span class="string">&quot;launch&quot;</span>,</span><br><span class="line"><span class="number">128</span>                 <span class="string">&quot;name&quot;</span>: <span class="string">&quot;Node.js&quot;</span>,</span><br><span class="line"><span class="number">129</span>                 <span class="string">&quot;program&quot;</span>: <span class="string">&quot;$&#123;file&#125;&quot;</span></span><br><span class="line"><span class="number">130</span>             &#125;,</span><br><span class="line"><span class="number">131</span>             &#123;</span><br><span class="line"><span class="number">132</span>                 <span class="string">&quot;type&quot;</span>: <span class="string">&quot;chrome&quot;</span>,</span><br><span class="line"><span class="number">133</span>                 <span class="string">&quot;request&quot;</span>: <span class="string">&quot;launch&quot;</span>,</span><br><span class="line"><span class="number">134</span>                 <span class="string">&quot;name&quot;</span>: <span class="string">&quot;vuejs: chrome&quot;</span>,</span><br><span class="line"><span class="number">135</span>                 <span class="string">&quot;url&quot;</span>: <span class="string">&quot;http://localhost:8080&quot;</span>,</span><br><span class="line"><span class="number">136</span>                 <span class="string">&quot;webRoot&quot;</span>: <span class="string">&quot;$&#123;workspaceFolder&#125;/src&quot;</span>,</span><br><span class="line"><span class="number">137</span>                 <span class="string">&quot;breakOnLoad&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"><span class="number">138</span>                 <span class="string">&quot;sourceMapPathOverrides&quot;</span>: &#123;</span><br><span class="line"><span class="number">139</span>                     <span class="string">&quot;webpack:///src/*&quot;</span>: <span class="string">&quot;$&#123;webRoot&#125;/*&quot;</span></span><br><span class="line"><span class="number">140</span>                 &#125;</span><br><span class="line"><span class="number">141</span>             &#125;</span><br><span class="line"><span class="number">142</span>         ],</span><br><span class="line"><span class="number">143</span>         <span class="string">&quot;compounds&quot;</span>: []</span><br><span class="line"><span class="number">144</span>     &#125;,</span><br><span class="line"><span class="number">145</span>     <span class="comment">// 是否格式化python文件</span></span><br><span class="line"><span class="number">146</span>     <span class="string">&quot;python.linting.enabled&quot;</span>: <span class="literal">false</span>,</span><br><span class="line"><span class="number">147</span>     <span class="comment">// 设置端口。开启apicloud在vscode中的wifi真机同步</span></span><br><span class="line"><span class="number">148</span>     <span class="string">&quot;apicloud.port&quot;</span>: <span class="string">&quot;23450&quot;</span>,</span><br><span class="line"><span class="number">149</span>     <span class="comment">// 设置apicloud在vscode中的wifi真机同步根目录，默认可不设置</span></span><br><span class="line"><span class="number">150</span>     <span class="string">&quot;apicloud.subdirectories&quot;</span>: <span class="string">&quot;/apicloudproject&quot;</span>,</span><br><span class="line"><span class="number">151</span></span><br><span class="line"><span class="number">152</span>     <span class="comment">// git 部分配置</span></span><br><span class="line"><span class="number">153</span>     <span class="string">&quot;gitlens.advanced.messages&quot;</span>: &#123;</span><br><span class="line"><span class="number">154</span>         <span class="string">&quot;suppressShowKeyBindingsNotice&quot;</span>: <span class="literal">true</span></span><br><span class="line"><span class="number">155</span>     &#125;,</span><br><span class="line"><span class="number">156</span>     <span class="string">&quot;git.path&quot;</span>: <span class="string">&quot;C:/Program Files/Git/cmd/git.exe&quot;</span>,</span><br><span class="line"><span class="number">157</span>     <span class="string">&quot;git.autofetch&quot;</span>: <span class="literal">true</span>,</span><br><span class="line"><span class="number">158</span>     <span class="string">&quot;git.confirmSync&quot;</span>: <span class="literal">false</span>,</span><br><span class="line"><span class="number">159</span></span><br><span class="line"><span class="number">160</span></span><br><span class="line"><span class="number">161</span>     <span class="string">&quot;open-in-browser.default&quot;</span>: <span class="string">&quot;Google Chrome&quot;</span>,</span><br><span class="line"><span class="number">162</span>     <span class="string">&quot;files.autoSave&quot;</span>: <span class="string">&quot;afterDelay&quot;</span>,</span><br><span class="line"><span class="number">163</span></span><br><span class="line"><span class="number">164</span>     <span class="string">&quot;emmet.includeLanguages&quot;</span>: &#123;</span><br><span class="line"><span class="number">165</span>         <span class="string">&quot;javascript&quot;</span>: <span class="string">&quot;javascriptreact&quot;</span></span><br><span class="line"><span class="number">166</span>     &#125;,</span><br><span class="line"><span class="number">167</span></span><br><span class="line"><span class="number">168</span>     <span class="string">&quot;workbench.startupEditor&quot;</span>: <span class="string">&quot;welcomePage&quot;</span>,</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<h2 id="将axios-挂载到-全局"><a href="#将axios-挂载到-全局" class="headerlink" title="将axios 挂载到 全局"></a>将axios 挂载到 全局</h2><h3 id="使用"><a href="#使用" class="headerlink" title="使用"></a>使用</h3><ol>
<li><p>在main.js中导入</p>
</li>
<li><p>使用  挂载</p>
</li>
<li><p>实例;</p>
</li>
<li><p>```js<br>// 1.下载资源包 npm i axios -S 下载包</p>
<p>import axios from ‘axios’<br>// 端口号之前都是跟路径<br>// 原路径： <a target="_blank" rel="noopener" href="http://www.liulongbin.top:3006/api/get">http://www.liulongbin.top:3006/api/get</a><br>// 根路径： <a target="_blank" rel="noopener" href="http://www.liulongbin.top:3006">http://www.liulongbin.top:3006</a><br>axios.defaults.baseURL = ‘请求根路径’<br>// 吧 axios 挂载到 Vue.prototype 原形上，共每个 .vue 组件的实例使用<br>Vue.prototype.$http = axios</p>
<p>// 2.今后，在每个 .vue 组件中要发起请求，直接调用 this.$http.xxx</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">### 2.在组件中</span><br><span class="line"></span><br><span class="line">1. ```js</span><br><span class="line">   // 1.对外共享</span><br><span class="line">   export default &#123;</span><br><span class="line">     methods: &#123;</span><br><span class="line">       async getInfo () &#123;</span><br><span class="line">         const &#123; data: res &#125; = await</span><br><span class="line">         // 2.使用</span><br><span class="line">   this.$http.get(&#x27;/api/get&#x27;)</span><br><span class="line">         console.log(res)</span><br><span class="line">       &#125;</span><br><span class="line">     &#125;</span><br><span class="line">   &#125;</span><br></pre></td></tr></table></figure>
</li>
</ol>
<h3 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h3><blockquote>
<ol>
<li>无法实现 API 接口的复用</li>
</ol>
</blockquote>
<h2 id="Vue-use-函数"><a href="#Vue-use-函数" class="headerlink" title="Vue.use()函数"></a>Vue.use()函数</h2><ol>
<li><p>这个函数 就是为 vue 装插件的</p>
</li>
<li><p>例如：</p>
</li>
<li><p>```js<br>// 1. 导入 Vue from 和 Vue Router 的包<br>import Vue from ‘vue’<br>import Vue from ‘vue-router’</p>
<p>// 2. 调用 Vue.use()函数，把 VueRouter 安装为 Vue 的插件</p>
<p>Vue.use(VueRouter)</p>
<p>// 3. 创建路由的实例对象<br>const router = new VueRouter()</p>
<p>// 4. 向外共享路由的实例对象<br>export default router</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">## 关闭 框架</span><br><span class="line"></span><br><span class="line">1. 使用链接:&lt;a href=&quot;JavaScript:parent.window.location.href= &#x27;../Index.aspx &#x27;;&quot;&gt;&lt;span&gt;退出登录&lt;/span&gt;&lt;/a&gt;</span><br><span class="line"></span><br><span class="line">## 不让页面刷新</span><br><span class="line"></span><br><span class="line">1. ```c#</span><br><span class="line">   // 写进 click 事件中</span><br><span class="line">   Button btn = new Button();</span><br><span class="line">   btn.Attributes.Add(&quot;onClick&quot;, &quot;return false&quot;);</span><br><span class="line">   btn.Enabled = false;</span><br></pre></td></tr></table></figure>
</li>
</ol>
<h2 id="获取当前时间"><a href="#获取当前时间" class="headerlink" title="获取当前时间"></a>获取当前时间</h2><h3 id="在c-ASP-net中"><a href="#在c-ASP-net中" class="headerlink" title="在c# / ASP.net中"></a>在c# / ASP.net中</h3><ol>
<li><p>```c#<br>在c# / ASP.net中我们可以通过使用DataTime这个类来获取当前的时间。通过调用类中的各种方法我们可以获取不同的时间：如：日期（2008-09-04）、时间（12：12：12）、日期+时间（2008-09-04 12：11：10）等。</p>
<pre><code>// 任取其一
</code></pre><p>//获取日期+时间<br>DateTime.Now.ToString();            // 2008-9-4 20:02:10<br>DateTime.Now.ToLocalTime().ToString();        // 2008-9-4 20:12:12</p>
<p>//获取日期<br>DateTime.Now.ToLongDateString().ToString();    // 2008年9月4日<br>DateTime.Now.ToShortDateString().ToString();    // 2008-9-4<br>DateTime.Now.ToString(“yyyy-MM-dd”);        // 2008-09-04<br>DateTime.Now.Date.ToString();            // 2008-9-4 0:00:00<br>//获取时间<br>DateTime.Now.ToLongTimeString().ToString();   // 20:16:16<br>DateTime.Now.ToShortTimeString().ToString();   // 20:16<br>DateTime.Now.ToString(“hh:mm:ss”);        // 08:05:57<br>DateTime.Now.TimeOfDay.ToString();        // 20:33:50.7187500</p>
<p>//其他<br>DateTime.ToFileTime().ToString();       // 128650040212500000<br>DateTime.Now.ToFileTimeUtc().ToString();   // 128650040772968750<br>DateTime.Now.ToOADate().ToString();       // 39695.8461709606<br>DateTime.Now.ToUniversalTime().ToString();   // 2008-9-4 12:19:14</p>
<p>DateTime.Now.Year.ToString();          获取年份   // 2008<br>DateTime.Now.Month.ToString();      获取月份   // 9<br>DateTime.Now.DayOfWeek.ToString(); 获取星期   // Thursday<br>DateTime.Now.DayOfYear.ToString(); 获取第几天   // 248<br>DateTime.Now.Hour.ToString();          获取小时   // 20<br>DateTime.Now.Minute.ToString();     获取分钟   // 31<br>DateTime.Now.Second.ToString();     获取秒数   // 45</p>
<p>//n为一个数,可以数整数,也可以事小数<br>dt.AddYears(n).ToString();   //时间加n年<br>dt.AddDays(n).ToString();   //加n天<br>dt.AddHours(n).ToString();   //加n小时<br>dt.AddMonths(n).ToString();   //加n个月<br>dt.AddSeconds(n).ToString();   //加n秒<br>dt.AddMinutes(n).ToString();   //加n分</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">### 在 sql 中</span><br><span class="line"></span><br><span class="line">1. ```sql</span><br><span class="line">   getdate():获取系统当前时间</span><br><span class="line">   dateadd(datepart,number,date):计算在一个时间的基础上增加一个时间后的新时间值,比如：dateadd(yy,30,getdate())</span><br><span class="line">   datediff(datepart,startdate,enddate):计算两个时间的差值,比如：datediff(yy,getdate(),&#x27;2008-08-08&#x27;)</span><br><span class="line">   dataname(datepart,date):获取时间不同部分的值，返回值为字符串</span><br><span class="line">   datepart(datepart,date):和datename相似，只是返回值为整型</span><br><span class="line">   day(date):获取指定时间的天数</span><br><span class="line">   month(date):获取指定时间的月份</span><br><span class="line">   year(date):获取指定时间的年份</span><br></pre></td></tr></table></figure>
</li>
</ol>
<p>2.</p>
<h2 id="强制权重最高"><a href="#强制权重最高" class="headerlink" title="强制权重最高"></a>强制权重最高</h2><ol>
<li><p>自己的样式，如果要覆盖别人的样式，就可以加，强制权重最高</p>
</li>
<li><p>!important</p>
</li>
<li><p>```css<br>.el-card{<br>  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15)!important;<br>  /<em> !important 强制权重最高</em>/<br>}</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">## 关闭事件</span><br><span class="line"></span><br><span class="line">1. 页面关闭时触发的事件</span><br><span class="line">2. @close=&quot;addDialogClpsed&quot;</span><br><span class="line"></span><br><span class="line">## 禁用表单</span><br><span class="line"></span><br><span class="line">1. disabled</span><br><span class="line"></span><br><span class="line">2. 实例：</span><br><span class="line"></span><br><span class="line">3. ```js</span><br><span class="line">   &lt;el-input v-model=&quot;editForm.username&quot; disabled&gt;&lt;/el-input&gt;</span><br><span class="line"></span><br></pre></td></tr></table></figure>
</li>
</ol>
<p>4.</p>
<h2 id="js中的-加载事件"><a href="#js中的-加载事件" class="headerlink" title="js中的 加载事件"></a>js中的 加载事件</h2><ol>
<li><p>close</p>
</li>
<li><p>```js<br>@close=”editDialogClosed”</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"></span><br><span class="line">## 隔行变色</span><br><span class="line"></span><br><span class="line">1. stripe</span><br><span class="line"></span><br><span class="line">2. ```js</span><br><span class="line">   &lt;el-table :data=&quot;rightsList&quot; border stripe&gt;</span><br><span class="line">   &lt;el-table&gt;</span><br></pre></td></tr></table></figure>
</li>
</ol>
<h2 id="展开列"><a href="#展开列" class="headerlink" title="展开列"></a>展开列</h2><ol>
<li><p>type=”expand”</p>
</li>
<li><p>```js<br><el-table-column type="expand">&lt;/el-table-column&gt;</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">## 级联</span><br><span class="line"></span><br><span class="line">1. ```js</span><br><span class="line">   &lt;el-cascader v-model=&quot;selectedKeys&quot; :options=&quot;ParentCateList&quot; :props=&quot;&#123; expandTrigger: &#x27;hover&#x27;, ...cascaderProps &#125;&quot; @change=&quot;parentCateChanged&quot; clearable&gt;&lt;/el-cascader&gt;</span><br></pre></td></tr></table></figure>
</li>
<li><p>```js<br>  // 指定具体级联选择器的配置对象</p>
<pre><code>  cascaderProps: &#123;
    value: &#39;cat_id&#39;,
    label: &#39;cat_name&#39;,
    children: &#39;children&#39;,
  &#125;,
</code></pre><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">3. 级联如果是显示不出来的话，设置 :props 的配置项 … 表示链接</span><br><span class="line"></span><br><span class="line">4. 黑马 vue P117,级联的绑定与取值</span><br><span class="line"></span><br><span class="line">## 动态绑定</span><br><span class="line"></span><br><span class="line">1. 如果数值方法属性等是动态的，则要动态绑定</span><br><span class="line"></span><br><span class="line">## 表格中的折叠</span><br><span class="line"></span><br><span class="line">1. 属性：type=&quot;expand&quot;</span><br><span class="line"></span><br><span class="line">2. ```js</span><br><span class="line">   &lt;el-table-column type=&quot;expand&quot;&gt;&lt;/el-table-column&gt;</span><br></pre></td></tr></table></figure>
</li>
</ol>
<h2 id="提交一个表单的数据对象"><a href="#提交一个表单的数据对象" class="headerlink" title="提交一个表单的数据对象"></a>提交一个表单的数据对象</h2><ol>
<li><p>写到请求地址后面，用 <code>逗号</code> 分隔，用 { } 包裹，</p>
</li>
<li><p><code>``js
this.$http.put(</code>categories/${this.cateId}/attributes/${this.editForm.attr_id}`,{attr_name: this.editForm.attr_name})</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">3. 提交一个参数 ：params关键字来接收</span><br><span class="line"></span><br><span class="line">4. ```js</span><br><span class="line">    const &#123; data: res &#125; = await this.$http.get(`categories/$&#123;this.cateId&#125;/attributes/$&#123;attr_id&#125;`, &#123;params: &#123; attr_sel: this.activeName &#125;&#125;)</span><br></pre></td></tr></table></figure>
</li>
</ol>
<h2 id="nextTick方法的作用"><a href="#nextTick方法的作用" class="headerlink" title="$nextTick方法的作用"></a>$nextTick方法的作用</h2><ol>
<li><p>方法的作用，就是当页面元素被重新渲染之后，才会指定回调函数中的代码</p>
</li>
<li><p>实例:</p>
</li>
<li><p>```js<br>// 让文本框自动获取焦点<br>this.$nextTick((_) =&gt; {</p>
<pre><code>    this.$refs.saveTagInput.$refs.input.focus()
  &#125;)
</code></pre><p>// 因为 el-input 是一个组件，先拿到组件，在拿到组件中的 DOM 元素input，所以会有两个 $refs<br>// 第一个 $refs 拿到 el-input,<br>// 第二个 $refs 获取原生的 DOM 元素 input</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"></span><br><span class="line">## 请求的参数</span><br><span class="line"></span><br><span class="line">1. get 请求的参数都要用 params：来指定</span><br><span class="line"></span><br><span class="line">2. ```js</span><br><span class="line">   this.$http.get(&#x27;goods&#x27;, &#123; params: this.queryInfo &#125;)</span><br></pre></td></tr></table></figure>
</li>
</ol>
<h2 id="定义为全局格式化时间的过滤器"><a href="#定义为全局格式化时间的过滤器" class="headerlink" title="定义为全局格式化时间的过滤器"></a>定义为全局格式化时间的过滤器</h2><ol>
<li><p>```js<br>// 在 main.js 中 定义</p>
<p>// 定义为全局可用的过滤器 originVal 处理时间的数据<br>// dateFormat 每个组件都可调用<br>Vue.filter(‘dateFormat’, function (originVal) {<br>  const dt = new Date(originVal) // 根据给定的时间得到一个日期对象<br>  const y = dt.getFullYear() //  4 位的年份<br>  const m = (dt.getMonth() + 1, ‘’).padStart(2, ‘0’) //  4 位的月份,’’先变成字符串，在 使用padStart属性，第一个参数为总长度为多少位，如果不足，则用0来填充<br>  const d = (dt.getDate() + ‘’).padStart(2, ‘0’) //  天<br>  const hh = (dt.getHours() + ‘’).padStart(2, ‘0’) //  时<br>  const mm = (dt.getMinutes() + ‘’).padStart(2, ‘0’) //  分<br>  const ss = (dt.getSeconds() + ‘’).padStart(2, ‘0’) //  秒</p>
<p>  return <code>$&#123;y&#125;-$&#123;m&#125;-$&#123;d&#125; $&#123;hh&#125;:$&#123;mm&#125;:$&#123;ss&#125;</code><br>})</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">## 数字和字符串的转换方式</span><br><span class="line"></span><br><span class="line">1. +0,就可以将数字转换为字符串了，加0只会进行字符串的拼接</span><br><span class="line">2. +0就变成字符串了，加号是字符串的隐式转换方式</span><br><span class="line">3. -0就变成数字了，减号是将字符串转换为数字的方式</span><br><span class="line"></span><br><span class="line">## 数组转换为字符串</span><br><span class="line"></span><br><span class="line">1. 如果要将一个空数组转为字符串，可以使用 join</span><br><span class="line"></span><br><span class="line">2. ```js</span><br><span class="line">   this.addForm.goods_cat = this.addForm.goods_cat.join(&#x27;,&#x27;)</span><br></pre></td></tr></table></figure>
</li>
<li><p>意为:将this.addForm.goods_cat数组，转换为字符串，在赋值给this.addForm.goods_cat</p>
</li>
<li><p>如果转换字符串的时候报错，就要考虑深拷贝，拷贝出一份新的对象，拼接join 的时候操作新对象</p>
</li>
<li><p>需要用到一个包 lodash</p>
</li>
<li><p>调用 cloneDeep(obj) 方法，</p>
</li>
<li><p>实例:</p>
</li>
<li><p>```js<br>// 1.先下载 lodash 这个包<br>// 2.在组件中导入<br>import <em> from ‘lodash’<br>// 3.进行深拷贝,这里拷贝数组,cloneDeep官方提供的方法<br>const form =</em>.cloneDeep(this.addForm)<br>// 4.转换为字符串,操作的是拷贝后的对象<br>form.goods_cat = form.goods_cat.join(‘,’)</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">## Nprogress 进度条</span><br><span class="line"></span><br><span class="line">1. ```</span><br><span class="line">   npm install --save nprogress</span><br></pre></td></tr></table></figure>
</li>
<li><p>在 main.js 中导入，</p>
</li>
<li><p>在 request 拦截器中，展示进度条，Nprogress.start()</p>
</li>
<li><p>在 response 拦截器中，隐藏进度条，Nprogress.done()</p>
</li>
<li><p>```js<br>// 1.Nprogress 进度条<br>import Nprogress from ‘nprogress’<br>// 2.Nprogress 样式<br>import ‘nprogress/nprogress.css’</p>
<p>// 在 request 拦截器中，展示进度条，Nprogress.start()<br>axios.interceptors.request.use((config) =&gt; {<br>  // 展示进度条<br>  Nprogress.start()<br>  // 在最后必须 return config<br>  return config<br>})</p>
<p>// 在 response 拦截器中，隐藏进度条 Nprogress.done()<br>axios.interceptors.response.use((consfig) =&gt; {<br>  // 隐藏进度条<br>  Nprogress.done()<br>  return consfig<br>})</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">6.</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">## babel 的使用，移除所有的console</span><br><span class="line"></span><br><span class="line">1. npm install babel-plugin-transform-remove-console --save-dev</span><br><span class="line"></span><br><span class="line">2. 开发依赖</span><br><span class="line"></span><br><span class="line">3. ```js</span><br><span class="line">   // 在 babel.config.js 文件中</span><br><span class="line">   const prodPlugins = []</span><br><span class="line">   if (process.env.NODE_ENV === &#x27;production&#x27;) &#123;</span><br><span class="line">     prodPlugins.push(&#x27;transform-remove-console&#x27;)</span><br><span class="line">   &#125;</span><br><span class="line">   module.exports = &#123;</span><br><span class="line">     presets: [&#x27;@vue/cli-plugin-babel/preset&#x27;],</span><br><span class="line">     plugins: [</span><br><span class="line">       [</span><br><span class="line">         &#x27;component&#x27;,</span><br><span class="line">         &#123;</span><br><span class="line">           libraryName: &#x27;element-ui&#x27;,</span><br><span class="line">           styleLibraryName: &#x27;theme-chalk&#x27;,</span><br><span class="line">         &#125;,</span><br><span class="line">         ...prodPlugins,</span><br><span class="line">       ],</span><br><span class="line">     ],</span><br><span class="line">   &#125;</span><br></pre></td></tr></table></figure>
</li>
</ol>
<h2 id="打包入口"><a href="#打包入口" class="headerlink" title="打包入口"></a>打包入口</h2><ol>
<li>main-dev.js 开发阶段的默认入口</li>
<li>main-prod.js 发布阶段默认入口<br>3.</li>
</ol>
<h2 id="无效token"><a href="#无效token" class="headerlink" title="无效token"></a>无效token</h2><ol>
<li><p>如果出现无效 token ，就要立即查看 main.js 中有没有 配置 axios与 token 有关的拦截器</p>
</li>
<li><p>```js<br>axios.interceptors.request.use((config) =&gt; {<br>  config.headers.Authorization = window.sessionStorage.getItem(‘token’)<br>  // 在最后必须 return config<br>  return config<br>})</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">3. 原理：向服务器器发送一个 config ，查看 token 是否过期，如果没有过期就延长 token 的过期时间</span><br><span class="line"></span><br><span class="line">## 自定义的验证规则</span><br><span class="line"></span><br><span class="line">### 邮箱</span><br><span class="line"></span><br><span class="line">1. ```js</span><br><span class="line">      // 自定义邮箱的验证规则</span><br><span class="line">       // rule,为验证规则，value，为待校验的值，cb，为一个回调函数</span><br><span class="line">       var checkEmail = (rule, value, cb) =&gt; &#123;</span><br><span class="line">         // 验证邮箱的正则表达式</span><br><span class="line">         const regEmail = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/</span><br><span class="line"></span><br><span class="line">         if (regEmail.test(value)) &#123;</span><br><span class="line">           // 合法的邮箱</span><br><span class="line">           return cb()</span><br><span class="line">         &#125;</span><br><span class="line">         cb(new Error(&#x27;请输入合法的邮箱!&#x27;))</span><br><span class="line">       &#125;</span><br></pre></td></tr></table></figure>
</li>
</ol>
<h3 id="手机号"><a href="#手机号" class="headerlink" title="手机号"></a>手机号</h3><ol>
<li>```js<br>// 自定义手机号的验证规则<pre><code>var checkMobile = (rule, value, cb) =&gt; &#123;
  // 验证手机号的正则表达式
  const regMobile = /^(0|8|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]&#123;8&#125;$/
  if (regMobile.test(value)) &#123;
    return cb()
  &#125;
  cb(new Error(&#39;请输入合法的手机号&#39;))
&#125;
</code></pre><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">### 调用方法</span><br><span class="line"></span><br><span class="line">1. ```js</span><br><span class="line">     // 邮箱的验证规则</span><br><span class="line">           email: [</span><br><span class="line">             // 必填</span><br><span class="line">             &#123; required: true, message: &#x27;请输入正确的邮箱格式&#x27;, trigger: &#x27;blur&#x27; &#125;,</span><br><span class="line">             // 验证 validator，调用 邮箱验证的方法</span><br><span class="line">             &#123; validator: checkEmail, trigger: &#x27;blur&#x27; &#125;,</span><br><span class="line">           ],</span><br><span class="line">     // 手机号验证规则</span><br><span class="line">           mobile: [</span><br><span class="line">             &#123; required: true, message: &#x27;请输入格式正确的手机号&#x27;, trigger: &#x27;blur&#x27; &#125;,</span><br><span class="line">             // 验证 validator，调用 邮箱验证的方法</span><br><span class="line">             &#123; validator: checkMobile, trigger: &#x27;blur&#x27; &#125;,</span><br><span class="line">           ],</span><br></pre></td></tr></table></figure>
</li>
</ol>
<h1 id="递归函数"><a href="#递归函数" class="headerlink" title="递归函数"></a>递归函数</h1><ol>
<li><p>通过递归的形式，获取角色下所有三级权限的id，并保存到 defkeys 数组中</p>
</li>
<li><p>```js<br>   getListKeys(node, arr) {</p>
<pre><code>  // 如果 当前 node 节点不包含 children 属性，则是三级节点
  if (!node.children) &#123;
    // 将 id 返回
    return arr.push(node.id)
  &#125;
  // 遍历循环
  node.children.forEach((item) =&gt; this.getListKeys(item, arr))
&#125;,
// 分配的确定事件
FenRolesDialog() &#123;&#125;,
</code></pre><p>  },</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">3. 调用</span><br><span class="line"></span><br><span class="line">4. ```js</span><br><span class="line">     // 调用递归函数 传进两个参数，id 和 数组，这样可以让节点选中</span><br><span class="line">   // roId 是 选中行的对象</span><br><span class="line">         this.getListKeys(roId, this.defkeys)</span><br></pre></td></tr></table></figure>
</li>
</ol>
<h1 id="目录树的确定事件"><a href="#目录树的确定事件" class="headerlink" title="目录树的确定事件"></a>目录树的确定事件</h1><ol>
<li>```js<br>// 确定事件</li>
</ol>
<p>   async FenRolesDialog() {<br>         const keys = [<br>           // 你好<br>           …this.$refs.treeRef.getCheckedKeys(),<br>           …this.$refs.treeRef.getHalfCheckedKeys(),<br>         ]<br>         // 数组用 逗号 分隔<br>         const idStr = keys.join(‘,’)<br>         const { data: res } = await this.$http.post(<code>roles/$&#123;this.roleId&#125;/rights</code>, { rids: idStr })<br>         if (res.meta.status !== 200) {<br>           return this.$message.error(‘分配权限失败’)<br>         }<br>         this.$message.success(‘分配权限成功’)<br>         // 刷新数据列表<br>         this.getRoles()<br>         // 隐藏整个对话框<br>         this.FenDialogVisible = false<br>       },<br>   <figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">2. 按钮的点击事件</span><br><span class="line"></span><br><span class="line">3. ```js</span><br><span class="line">    // 分配按钮</span><br><span class="line">       async SelRol(roId) &#123;</span><br><span class="line">         // 将点击的这一行的数据对象传进来，传进来之后找到id，赋值给this.roleId</span><br><span class="line">         this.roleId = roId.id</span><br><span class="line">         const &#123; data: res &#125; = await this.$http.get(&#x27;rights/tree&#x27;)</span><br><span class="line">         if (res.meta.status !== 200) &#123;</span><br><span class="line">           return this.$message.error(&#x27;获取权限失败!&#x27;)</span><br><span class="line">         &#125;</span><br><span class="line">         this.FenRightslist = res.data</span><br><span class="line">         // 调用递归函数 传进两个参数，id 和 数组，这样可以让节点选中</span><br><span class="line">         this.getListKeys(roId, this.defkeys)</span><br><span class="line">         this.FenDialogVisible = true</span><br><span class="line">       &#125;,</span><br></pre></td></tr></table></figure></p>
<h2 id="页面的完整渲染-和-页面的-局部渲染-刷新"><a href="#页面的完整渲染-和-页面的-局部渲染-刷新" class="headerlink" title="页面的完整渲染 和 页面的 局部渲染 (刷新)"></a>页面的完整渲染 和 页面的 局部渲染 (刷新)</h2><ol>
<li><p>刷新，也就是重新获取数据</p>
</li>
<li><p>但是，如果重新调用接口，页面就会完整渲染</p>
</li>
<li><p>吧服务器返回的最新数据，返回给当前角色 的 children</p>
</li>
<li><p>就不会出现 页面完整渲染，也能完成页面的刷新</p>
</li>
<li><p>```js<br>rol.children = res.data</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">## 定义时间的过滤器</span><br><span class="line"></span><br><span class="line">1. ```js</span><br><span class="line">   // 定义为全局可用的过滤器 originVal 处理时间的数据</span><br><span class="line">   // dateFormat 每个组件都可调用</span><br><span class="line"></span><br><span class="line">   Vue.filter(&#x27;dateFormat&#x27;, function (originVal) &#123;</span><br><span class="line">     const dt = new Date(originVal) // 根据给定的时间得到一个日期对象</span><br><span class="line">     const y = dt.getFullYear() //  4 位的年份</span><br><span class="line">     const m = (dt.getMonth() + 1, &#x27;&#x27;).padStart(2, &#x27;0&#x27;) //  4 位的月份,&#x27;&#x27;先变成字符串，在 使用padStart属性，第一个参数为总长度为多少位，如果不足，则用0来填充</span><br><span class="line">     const d = (dt.getDate() + &#x27;&#x27;).padStart(2, &#x27;0&#x27;) //  天</span><br><span class="line">     const hh = (dt.getHours() + &#x27;&#x27;).padStart(2, &#x27;0&#x27;) //  时</span><br><span class="line">     const mm = (dt.getMinutes() + &#x27;&#x27;).padStart(2, &#x27;0&#x27;) //  分</span><br><span class="line">     const ss = (dt.getSeconds() + &#x27;&#x27;).padStart(2, &#x27;0&#x27;) //  秒</span><br><span class="line"></span><br><span class="line">     return `$&#123;y&#125;-$&#123;m&#125;-$&#123;d&#125; $&#123;hh&#125;:$&#123;mm&#125;:$&#123;ss&#125;`</span><br><span class="line">   &#125;)</span><br></pre></td></tr></table></figure>
</li>
</ol>
<h1 id="Layout-后台模板"><a href="#Layout-后台模板" class="headerlink" title="Layout 后台模板"></a>Layout 后台模板</h1><ol>
<li><p>```html<br>@{</p>
<pre><code>ViewBag.Title = &quot;MYLayout&quot;;
</code></pre><p>}</p>
<p><html xmlns="http://www.w3.org/1999/xhtml"><br><head></p>
<pre><code>&lt;title&gt;&lt;/title&gt;
&lt;style type=&quot;text/css&quot;&gt;
    * &#123;
        margin: 0px;
        padding: 0px;
    &#125;

    .con &#123;
        width: 100%;
        background-color: black;
    &#125;

    .u1 &#123;
        width: 1000px;
        margin: 0 auto;
        list-style: none;
        height: 50px;
    &#125;

    .l1 &#123;
        width: 100px;
        float: left;
        line-height: 50px;
        padding-left: 50px;
        text-align: center;
        color: aliceblue;
    &#125;

    .u2 &#123;
        width: 100px;
        margin: 0 auto;
        list-style: none;
        height: 50px;
    &#125;

    .l2 &#123;
        width: 100px;
        float: left;
        line-height: 80px;
        text-align: center;
        color: aliceblue;
    &#125;

    .con2 &#123;
        width: 100px;
        height: 100%;
        background-color: #141313ee;
        float: left;
    &#125;

    .con3 &#123;
        display: inherit;
        float: left;
    &#125;
&lt;/style&gt;
</code></pre><p>&lt;/head&gt;<br><body></p>
<pre><code>&lt;div class=&quot;con&quot;&gt;
    &lt;ul class=&quot;u1&quot;&gt;
        &lt;li class=&quot;l1&quot;&gt;首页&lt;/li&gt;
        &lt;li class=&quot;l1&quot;&gt;首页&lt;/li&gt;
        &lt;li class=&quot;l1&quot;&gt;首页&lt;/li&gt;
        &lt;li class=&quot;l1&quot;&gt;首页&lt;/li&gt;
        &lt;li class=&quot;l1&quot;&gt;首页&lt;/li&gt;
        &lt;li class=&quot;l1&quot;&gt;首页&lt;/li&gt;
    &lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;con2&quot;&gt;
    &lt;ul class=&quot;u2&quot;&gt;
        &lt;li class=&quot;l2&quot;&gt;你好&lt;/li&gt;
        &lt;li class=&quot;l2&quot;&gt;你好&lt;/li&gt;
        &lt;li class=&quot;l2&quot;&gt;你好&lt;/li&gt;
        &lt;li class=&quot;l2&quot;&gt;你好&lt;/li&gt;
        &lt;li class=&quot;l2&quot;&gt;你好&lt;/li&gt;
        &lt;li class=&quot;l2&quot;&gt;你好&lt;/li&gt;
        &lt;li class=&quot;l2&quot;&gt;你好&lt;/li&gt;
    &lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;con3&quot;&gt;
    @RenderBody()
&lt;/div&gt;
</code></pre><p>&lt;/body&gt;<br>&lt;/html&gt;</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"># 页面暂停显示</span><br><span class="line"></span><br><span class="line">1. c# 中 的方法</span><br><span class="line"></span><br><span class="line">2. 线程的,运行到这个方法的时候，暂停 5 秒，在运行之后的代码</span><br><span class="line"></span><br><span class="line">3. ```c#</span><br><span class="line">    // 线程的，运行到这个方法的时候，暂停 5 秒</span><br><span class="line">   System.Threading.Thread.Sleep(5000);</span><br></pre></td></tr></table></figure>
</li>
<li><p>例如：</p>
</li>
<li><p>```html<br>   获取到的时间:</p>
<pre><code>&lt;div id=&quot;loding&quot; style=&quot;display:none&quot;&gt;数据正在加载中&lt;/div&gt;
&lt;div id=&quot;show&quot;&gt;&lt;/div&gt;
</code></pre>   <figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"></span><br></pre></td></tr></table></figure>
</li>
<li><p>```c#</p>
<pre><code>    public ActionResult UserRegister(string Username,string Password)
    &#123;
        // 线程的，运行到这个方法的时候，暂停 5 秒
        System.Threading.Thread.Sleep(5000);

        ViewBag.name = Username;
        ViewBag.pwd = Password;
        return View(&quot;result&quot;);
    &#125;
</code></pre><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">7.</span><br><span class="line"></span><br><span class="line"># MVC 分页功能</span><br><span class="line"></span><br><span class="line">利用路由实现</span><br><span class="line"></span><br><span class="line"> 分页实现步骤：</span><br><span class="line"></span><br><span class="line">1. 定义变量：当前页（pageIndex），页面尺寸（pagesize），总页数（pageCount）</span><br><span class="line"></span><br><span class="line">2. Skip（num）表示跳过指定数量的序列中的元素，返回剩余的元素，使用之前往往需要对这个序列进行排序</span><br><span class="line"></span><br><span class="line">3. Take(int num)</span><br><span class="line"></span><br><span class="line">4. 设计布局结构</span><br><span class="line"></span><br><span class="line">   1. 查询所有的产品数据，以集合的形式传递到前端页面</span><br><span class="line"></span><br><span class="line">   2. 页面的总数量,向上取整</span><br><span class="line"></span><br><span class="line">   3. 重新组织集合的条目数，每一次传递过来的集合中只有三条记录</span><br><span class="line"></span><br><span class="line">   4. 当前页 减一，乘以最大的尺寸 Skip((PageIndex - 1) * PageSize)</span><br><span class="line"></span><br><span class="line">   5. Take(PageSize)取页面规定的数量</span><br><span class="line"></span><br><span class="line">   6. 控制器页面</span><br><span class="line"></span><br><span class="line">   7. ```c#</span><br><span class="line">      using paging.Models;</span><br><span class="line">      using System.Collections.Generic;</span><br><span class="line">      using System.Data.Entity;</span><br><span class="line">      using System.Linq;</span><br><span class="line">      using System.Web.Mvc;</span><br><span class="line"></span><br><span class="line">      namespace paging.Controllers</span><br><span class="line">      &#123;</span><br><span class="line">          public class HomeController : Controller</span><br><span class="line">          &#123;</span><br><span class="line">              private XiaoMiEntities db = new XiaoMiEntities();</span><br><span class="line"></span><br><span class="line">              public ActionResult Index(int PageIndex = 1, int PageSize = 3)</span><br><span class="line">              &#123;</span><br><span class="line">                  // 1.查询所有的产品数据，以集合的形式传递到前端页面</span><br><span class="line">                  IEnumerable&lt;GoodsInfo&gt; list = db.GoodsInfoes;</span><br><span class="line"></span><br><span class="line">                  // 页面的总数量,向上取整</span><br><span class="line">                  int num = list.Count();</span><br><span class="line">                  int PageCount = num % PageSize == 0 ? num / PageSize : (num / PageSize) + 1;</span><br><span class="line"></span><br><span class="line">                  // 2.重新组织集合的条目数，每一次传递过来的集合中只有三条记录</span><br><span class="line"></span><br><span class="line">                  // 3.当前页 减一，乘以最大的尺寸 Skip((PageIndex - 1) * PageSize)</span><br><span class="line"></span><br><span class="line">                  // 4.Take(PageSize)取页面规定的数量</span><br><span class="line">                  IEnumerable&lt;GoodsInfo&gt; list1 = db.GoodsInfoes.OrderBy(x =&gt; x.Goodsld).Skip((PageIndex - 1) * PageSize).Take(PageSize);</span><br><span class="line">                  ViewBag.PageIndex = PageIndex;</span><br><span class="line">                  ViewBag.PageCount = PageCount;</span><br><span class="line">                  return View(list1);</span><br><span class="line">              &#125;</span><br><span class="line">          &#125;</span><br><span class="line">      &#125;</span><br></pre></td></tr></table></figure>
<ol>
<li><p>index 页面</p>
</li>
<li><p>```html<br>@model IEnumerable<paging.Models.GoodsInfo></p>
<p>@{</p>
<pre><code>ViewBag.Title = &quot;Index&quot;;
Layout = &quot;~/Views/Shared/_Layout.cshtml&quot;;

int PageNow = ViewBag.PageIndex;
int PageAll = ViewBag.PageCount;
</code></pre><p>}</p>
<table class="table table-bordered table-hover">
    <thead>
        <tr>
            <th>编号</th>
            <th>名称</th>
            <th>描述</th>
            <th>价格</th>
            <th>图片</th>
            <th>状态</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td>@item.Goodsld</td>
                <td>@item.GoodsName</td>
                <td>@item.GoodsDesc</td>
                <td>@item.GoodsPrice</td>
                <td>@item.Goodsimage</td>
                <td>@item.Goodsls</td>
            </tr>
        }
    </tbody>
</table>

<p>@if (PageNow &lt;= 1)<br>{</p>
<pre><code>@Html.ActionLink(&quot;上一页&quot;, &quot;index&quot;, &quot;home&quot;, new &#123; PageIndex = 1, PageSize = 3 &#125;, new &#123; @class = &quot;btn btn-success&quot; &#125;)
</code></pre><p>}<br>else<br>{</p>
<pre><code>@Html.ActionLink(&quot;上一页&quot;, &quot;index&quot;, &quot;home&quot;, new &#123; PageIndex = PageNow - 1, PageSize = 3 &#125;, new &#123; @class = &quot;btn btn-success&quot; &#125;)
</code></pre><p>}</p>
<p><span>第 @PageNow 页/共 @PageAll 页</span></p>
<p>@if (PageNow &gt;= PageAll)<br>{</p>
<pre><code>@Html.ActionLink(&quot;下一页&quot;, &quot;index&quot;, &quot;home&quot;, new &#123; PageIndex = PageAll, PageSize = 3 &#125;, new &#123; @class = &quot;btn btn-success&quot; &#125;)
</code></pre><p>}<br>else<br>{</p>
<pre><code>@Html.ActionLink(&quot;下一页&quot;, &quot;index&quot;, &quot;home&quot;, new &#123; PageIndex = PageNow + 1, PageSize = 3 &#125;, new &#123; @class = &quot;btn btn-success&quot; &#125;)
</code></pre><p>}</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"># 动态添加或移除 id 属性</span><br><span class="line"></span><br><span class="line">1. 添加：</span><br><span class="line"></span><br><span class="line">   1. setAttribute(&#x27;attr_name&#x27;,&#x27;id的名称&#x27;);</span><br><span class="line">   2. 可简写成： divObj.id = &#x27;ziState&#x27;;</span><br><span class="line"></span><br><span class="line">2. 获取属性值：</span><br><span class="line"></span><br><span class="line">   1. getAttribute(‘attr_name’)</span><br><span class="line"></span><br><span class="line">3. 删除属性：</span><br><span class="line"></span><br><span class="line">   1. removeAttribute(&#x27;attr_name&#x27;);</span><br><span class="line"></span><br><span class="line">4. 通过 id 查找 HTML 元素</span><br><span class="line"></span><br><span class="line">   1. document.getElementById(&quot;intro&quot;);</span><br><span class="line"></span><br><span class="line">5. 通过标签名查找 HTML 元素</span><br><span class="line"></span><br><span class="line">   1. getElementsByTagName(&quot;p&quot;)</span><br><span class="line"></span><br><span class="line">6. 通过类名找到 HTML 元素</span><br><span class="line"></span><br><span class="line">   1.   document.getElementsByClassName(&quot;intro&quot;);</span><br><span class="line"></span><br><span class="line">7. 前提：</span><br><span class="line"></span><br><span class="line">8. 要先获取到这个标签的元素或属性</span><br><span class="line"></span><br><span class="line">9. 例如：</span><br><span class="line"></span><br><span class="line">   1. 要给点击的 a 标签添加一个 id</span><br><span class="line"></span><br><span class="line">   2. 要先找到a标签的元素</span><br><span class="line"></span><br><span class="line">   3. 通过类名找到 var divObj = document.getElementsByClassName(&quot;hy&quot;)[0];</span><br><span class="line"></span><br><span class="line">   4. ```js</span><br><span class="line">       $(&quot;.hy&quot;).click(function () &#123;</span><br><span class="line">                      // 给 点击的 a 标签追加 id</span><br><span class="line">                      divObj.id = &#x27;ziState&#x27;;</span><br><span class="line">           		   // 移除 类名为 yh 的 id</span><br><span class="line">                      yh.removeAttribute(&#x27;id&#x27;)</span><br><span class="line">                  &#125;)</span><br></pre></td></tr></table></figure>
</li>
</ol>
</li>
</ol>
<h1 id="立即执行函数"><a href="#立即执行函数" class="headerlink" title="立即执行函数"></a>立即执行函数</h1><ol>
<li><p>为了防止变量的污染，减少命名的冲突，我们可以才用立即执行函数的写法，因为里面的变量都是局部变量</p>
</li>
<li><p>```js<br>(function(){</p>
<pre><code>var = ....
</code></pre><p>}<br>)(); //分好结尾</p>
<p>(function(){</p>
<pre><code>var = ....
</code></pre><p>}<br>)(); //分好结尾</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">3. 多个立即函数必须以 分好结尾</span><br><span class="line"></span><br><span class="line"># C#</span><br><span class="line"></span><br><span class="line">## 关闭所有窗口</span><br><span class="line"></span><br><span class="line">1. ```c#</span><br><span class="line">   //关闭系统</span><br><span class="line">               System.Environment.Exit(0);//0为正常关闭，1为非正常关闭</span><br></pre></td></tr></table></figure>
</li>
</ol>
<h1 id="Js"><a href="#Js" class="headerlink" title="Js"></a>Js</h1><h2 id="获取当前时间-1"><a href="#获取当前时间-1" class="headerlink" title="获取当前时间"></a>获取当前时间</h2><ol>
<li>```js<br> var t = null;<pre><code>t = setTimeout(time, 1000); //开始运行
function time() &#123;
    clearTimeout(t); //清除定时器
    dt = new Date();
    var y = dt.getFullYear();
    var mt = dt.getMonth() + 1;
    var day = dt.getDate();
    var h = dt.getHours(); //获取时
    var m = dt.getMinutes(); //获取分
    var s = dt.getSeconds(); //获取秒
    document.querySelector(&quot;.showTime&quot;).innerHTML =
        &quot;当前时间：&quot; +
        y +
        &quot;年&quot; +
        mt +
        &quot;月&quot; +
        day +
        &quot;-&quot; +
        h +
        &quot;时&quot; +
        m +
        &quot;分&quot; +
        s +
        &quot;秒&quot;;
    t = setTimeout(time, 1000); //设定定时器，循环运行
&#125;
</code></pre><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">2. ```html</span><br><span class="line">   &lt;span class=&quot;showTime&quot;&gt;当前时间：2020年3月17-0时54分14秒&lt;/span&gt;</span><br><span class="line"></span><br></pre></td></tr></table></figure>
</li>
</ol>
<p>3.</p>
<p>4.</p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="http://example.com">晚夜微雨问海棠</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="http://example.com/posts/7ee65b9f.html">http://example.com/posts/7ee65b9f.html</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="http://example.com" target="_blank">晚夜微雨问海棠のBlog</a>！</span></div></div><div class="tag_share"><div class="post_share"><div class="social-share" data-image="https://img1.baidu.com/it/u=2163263263,2058666557&amp;fm=253&amp;fmt=auto&amp;app=138&amp;f=JPEG?w=500&amp;h=497" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button"><i class="fas fa-qrcode"></i> 打赏</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="https://s1.ax1x.com/2022/11/15/zE9P7d.jpg" target="_blank"><img class="post-qr-code-img" src= "" data-lazy-src="https://s1.ax1x.com/2022/11/15/zE9P7d.jpg" alt="微信"/></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="https://s1.ax1x.com/2022/11/15/zE9ung.jpg" target="_blank"><img class="post-qr-code-img" src= "" data-lazy-src="https://s1.ax1x.com/2022/11/15/zE9ung.jpg" alt="支付宝"/></a><div class="post-qr-code-desc">支付宝</div></li></ul></div></div><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><div><a href="/posts/927e84a1.html" title="Markdown使用小技巧"><img class="cover" src= "" data-lazy-src="https://s1.ax1x.com/2022/12/06/z65aXq.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2022-12-06</div><div class="title">Markdown使用小技巧</div></div></a></div><div><a href="/posts/8b6c3947.html" title="VS插件"><img class="cover" src= "" data-lazy-src="https://s1.ax1x.com/2023/03/11/ppKS8V1.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2023-03-04</div><div class="title">VS插件</div></div></a></div><div><a href="/posts/bb2c23b2.html" title="Win11使用技巧"><img class="cover" src= "" data-lazy-src="https://s1.ax1x.com/2023/03/11/ppKp4SO.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2023-03-08</div><div class="title">Win11使用技巧</div></div></a></div><div><a href="/posts/a9613e02.html" title="VSCode配置"><img class="cover" src= "" data-lazy-src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg-blog.csdnimg.cn%2Fimg_convert%2Fe7fcf8b0b298ddb26f73d69389f0b606.png&refer=http%3A%2F%2Fimg-blog.csdnimg.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1665288100&t=6924eef2523e798f2f451b4237c40a02" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2022-11-12</div><div class="title">VSCode配置</div></div></a></div><div><a href="/posts/6c53f471.html" title="前端+后端知识汇总（2）"><img class="cover" src= "" data-lazy-src="https://img1.baidu.com/it/u=2163263263,2058666557&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=497" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2022-11-12</div><div class="title">前端+后端知识汇总（2）</div></div></a></div><div><a href="/posts/3df4b4e4.html" title="好用的软件"><img class="cover" src= "" data-lazy-src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.11467.com%2F2020%2F04-23%2F1160456217.jpg&refer=http%3A%2F%2Fimg.11467.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1665287815&t=3b6f36234b71a75c02ce9d146bd29909" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2022-11-12</div><div class="title">好用的软件</div></div></a></div></div></div><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div class="vcomment" id="vcomment"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content is-expand"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%89%8D%E8%A8%80"><span class="toc-number">1.</span> <span class="toc-text">前言:</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%83%8C%E6%99%AF%E9%9F%B3%E4%B9%90"><span class="toc-number">2.</span> <span class="toc-text">背景音乐</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#SQL-server"><span class="toc-number">3.</span> <span class="toc-text">SQL server</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BA%8B%E5%8A%A1"><span class="toc-number">3.1.</span> <span class="toc-text">事务</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%A7%A6%E5%8F%91%E5%99%A8"><span class="toc-number">3.2.</span> <span class="toc-text">触发器</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Javascript"><span class="toc-number">4.</span> <span class="toc-text">Javascript</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BA%8C%E7%BA%A7%E8%8F%9C%E5%8D%95"><span class="toc-number">4.1.</span> <span class="toc-text">二级菜单</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%BF%87%E6%BB%A4-filter-%E7%9A%84%E4%BD%BF%E7%94%A8"><span class="toc-number">4.2.</span> <span class="toc-text">过滤 filter 的使用</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#puth-%E7%94%A8%E6%B3%95"><span class="toc-number">4.3.</span> <span class="toc-text">puth 用法</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%88%AA%E5%8F%96%E5%AD%97%E7%AC%A6%E4%B8%B2"><span class="toc-number">4.4.</span> <span class="toc-text">截取字符串</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%A8%A1%E6%9D%BF%E5%AF%B9%E8%B1%A1"><span class="toc-number">4.5.</span> <span class="toc-text">模板对象</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#ASP-Net-WebForm"><span class="toc-number">5.</span> <span class="toc-text">ASP.Net WebForm</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#session-%E4%BC%A0%E5%80%BC%E7%94%A8%E6%B3%95"><span class="toc-number">5.1.</span> <span class="toc-text">session 传值用法</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#frameset%E7%9A%84%E5%B1%9E%E6%80%A7%E5%8F%8A%E7%94%A8%E6%B3%95"><span class="toc-number">5.2.</span> <span class="toc-text">frameset的属性及用法</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#frameset"><span class="toc-number">5.3.</span> <span class="toc-text">frameset</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Equals-%E6%98%AF%E5%90%A6%E7%9B%B8%E7%AD%89"><span class="toc-number">5.4.</span> <span class="toc-text">Equals 是否相等</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%8E%B7%E5%8F%96%E5%A4%8D%E9%80%89%E6%A1%86%E7%9A%84%E5%80%BC"><span class="toc-number">5.5.</span> <span class="toc-text">获取复选框的值</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%8A%A8%E6%80%81%E6%98%BE%E7%A4%BA%E5%BD%93%E5%89%8D%E7%B3%BB%E7%BB%9F%E6%97%B6%E9%97%B4"><span class="toc-number">5.6.</span> <span class="toc-text">动态显示当前系统时间</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%85%B3%E9%97%AD%E5%BD%93%E5%89%8D%E7%BD%91%E9%A1%B5"><span class="toc-number">5.7.</span> <span class="toc-text">关闭当前网页</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#12306%E4%B8%AD%E9%81%87%E5%88%B0%E7%9A%84%E9%97%AE%E9%A2%98"><span class="toc-number">5.8.</span> <span class="toc-text">12306中遇到的问题</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%9A%90%E8%97%8F%E6%8E%A7%E4%BB%B6"><span class="toc-number">5.9.</span> <span class="toc-text">隐藏控件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%AA%8C%E8%AF%81%E6%8E%A7%E4%BB%B6"><span class="toc-number">5.10.</span> <span class="toc-text">验证控件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%B7%B3%E8%BD%AC%E9%A1%B5%E9%9D%A2%E7%9A%84%E5%87%A0%E7%A7%8D%E6%96%B9%E6%B3%95"><span class="toc-number">5.11.</span> <span class="toc-text">跳转页面的几种方法</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%8F%90%E7%A4%BA%E5%B9%B6%E8%B7%B3%E8%BD%AC"><span class="toc-number">5.12.</span> <span class="toc-text">提示并跳转</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%B8%8A%E4%BC%A0%E5%9B%BE%E7%89%87"><span class="toc-number">5.13.</span> <span class="toc-text">上传图片</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%B0%86-div%E5%BD%93%E6%88%90%E6%8F%90%E7%A4%BA%E6%A1%86%E6%98%BE%E7%A4%BA"><span class="toc-number">5.14.</span> <span class="toc-text">将 div当成提示框显示</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%BF%94%E5%9B%9E%E9%A1%B6%E9%83%A8"><span class="toc-number">5.15.</span> <span class="toc-text">返回顶部</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%98%BE%E7%A4%BA%E4%B8%8E%E9%9A%90%E8%97%8F"><span class="toc-number">5.16.</span> <span class="toc-text">显示与隐藏</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%BD%AE%E6%92%AD%E5%9B%BE"><span class="toc-number">5.17.</span> <span class="toc-text">轮播图</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%B8%A4%E4%B8%AA%E6%96%87%E6%9C%AC%E6%A1%86%E5%90%8C%E6%AD%A5"><span class="toc-number">5.18.</span> <span class="toc-text">两个文本框同步</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%97%B6%E9%97%B4"><span class="toc-number">5.19.</span> <span class="toc-text">时间</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%A0%B9%E6%8D%AE-id-%E6%9F%A5%E8%AF%A2%E6%95%B0%E6%8D%AE%EF%BC%8C%E5%B9%B6%E5%B0%86%E6%9F%A5%E8%AF%A2%E5%87%BA%E6%9D%A5%E7%9A%84%E6%95%B0%E6%8D%AE%E8%B5%8B%E5%80%BC%E7%BB%99-%E6%8E%A7%E4%BB%B6"><span class="toc-number">5.20.</span> <span class="toc-text">根据 id 查询数据，并将查询出来的数据赋值给 控件</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%B8%90%E5%8F%98%E8%83%8C%E6%99%AF"><span class="toc-number">5.21.</span> <span class="toc-text">渐变背景</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9C%A8%E6%9C%80%E5%89%8D%E6%96%B9%E6%98%BE%E7%A4%BA"><span class="toc-number">5.22.</span> <span class="toc-text">在最前方显示</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%A1%A8%E5%8D%95%E5%AE%9A%E4%BD%8D%E9%97%AE%E9%A2%98"><span class="toc-number">5.23.</span> <span class="toc-text">表单定位问题</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%A0%87%E7%AD%BE%E5%86%85%E5%86%99%E4%BA%8B%E4%BB%B6%E5%86%85%E5%AE%B9"><span class="toc-number">6.</span> <span class="toc-text">标签内写事件内容</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%BD%91%E9%A1%B5%E4%B8%AD%E7%9A%84-%E7%AC%A6%E5%8F%B7"><span class="toc-number">7.</span> <span class="toc-text">网页中的 $符号</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%A4%B1%E5%8E%BB%E7%84%A6%E7%82%B9%E7%9A%84%E4%BA%8B%E4%BB%B6"><span class="toc-number">8.</span> <span class="toc-text">失去焦点的事件</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%8E%B7%E5%BE%97%E7%84%A6%E7%82%B9%E7%9A%84%E4%BA%8B%E4%BB%B6"><span class="toc-number">9.</span> <span class="toc-text">获得焦点的事件</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%95%B0%E7%BB%84%E4%B8%AD%E7%9A%84%E5%BE%AA%E7%8E%AF"><span class="toc-number">10.</span> <span class="toc-text">数组中的循环</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%B8%B8%E7%94%A8%E7%9A%84%E7%BB%93%E8%AE%BA%EF%BC%8C%E7%BA%A6%E5%AE%9A"><span class="toc-number">11.</span> <span class="toc-text">常用的结论，约定</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#json-js-%E9%85%8D%E7%BD%AE"><span class="toc-number">12.</span> <span class="toc-text">json.js 配置</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%B0%86axios-%E6%8C%82%E8%BD%BD%E5%88%B0-%E5%85%A8%E5%B1%80"><span class="toc-number">13.</span> <span class="toc-text">将axios 挂载到 全局</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%BD%BF%E7%94%A8"><span class="toc-number">13.1.</span> <span class="toc-text">使用</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%80%BB%E7%BB%93"><span class="toc-number">13.2.</span> <span class="toc-text">总结</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Vue-use-%E5%87%BD%E6%95%B0"><span class="toc-number">14.</span> <span class="toc-text">Vue.use()函数</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E6%97%B6%E9%97%B4"><span class="toc-number">15.</span> <span class="toc-text">获取当前时间</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E5%9C%A8c-ASP-net%E4%B8%AD"><span class="toc-number">15.1.</span> <span class="toc-text">在c# &#x2F; ASP.net中</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%BC%BA%E5%88%B6%E6%9D%83%E9%87%8D%E6%9C%80%E9%AB%98"><span class="toc-number">16.</span> <span class="toc-text">强制权重最高</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#js%E4%B8%AD%E7%9A%84-%E5%8A%A0%E8%BD%BD%E4%BA%8B%E4%BB%B6"><span class="toc-number">17.</span> <span class="toc-text">js中的 加载事件</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%B1%95%E5%BC%80%E5%88%97"><span class="toc-number">18.</span> <span class="toc-text">展开列</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%8F%90%E4%BA%A4%E4%B8%80%E4%B8%AA%E8%A1%A8%E5%8D%95%E7%9A%84%E6%95%B0%E6%8D%AE%E5%AF%B9%E8%B1%A1"><span class="toc-number">19.</span> <span class="toc-text">提交一个表单的数据对象</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#nextTick%E6%96%B9%E6%B3%95%E7%9A%84%E4%BD%9C%E7%94%A8"><span class="toc-number">20.</span> <span class="toc-text">$nextTick方法的作用</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AE%9A%E4%B9%89%E4%B8%BA%E5%85%A8%E5%B1%80%E6%A0%BC%E5%BC%8F%E5%8C%96%E6%97%B6%E9%97%B4%E7%9A%84%E8%BF%87%E6%BB%A4%E5%99%A8"><span class="toc-number">21.</span> <span class="toc-text">定义为全局格式化时间的过滤器</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%89%93%E5%8C%85%E5%85%A5%E5%8F%A3"><span class="toc-number">22.</span> <span class="toc-text">打包入口</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%97%A0%E6%95%88token"><span class="toc-number">23.</span> <span class="toc-text">无效token</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%89%8B%E6%9C%BA%E5%8F%B7"><span class="toc-number">23.1.</span> <span class="toc-text">手机号</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E9%80%92%E5%BD%92%E5%87%BD%E6%95%B0"><span class="toc-number"></span> <span class="toc-text">递归函数</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E7%9B%AE%E5%BD%95%E6%A0%91%E7%9A%84%E7%A1%AE%E5%AE%9A%E4%BA%8B%E4%BB%B6"><span class="toc-number"></span> <span class="toc-text">目录树的确定事件</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%A1%B5%E9%9D%A2%E7%9A%84%E5%AE%8C%E6%95%B4%E6%B8%B2%E6%9F%93-%E5%92%8C-%E9%A1%B5%E9%9D%A2%E7%9A%84-%E5%B1%80%E9%83%A8%E6%B8%B2%E6%9F%93-%E5%88%B7%E6%96%B0"><span class="toc-number">1.</span> <span class="toc-text">页面的完整渲染 和 页面的 局部渲染 (刷新)</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#Layout-%E5%90%8E%E5%8F%B0%E6%A8%A1%E6%9D%BF"><span class="toc-number"></span> <span class="toc-text">Layout 后台模板</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E7%AB%8B%E5%8D%B3%E6%89%A7%E8%A1%8C%E5%87%BD%E6%95%B0"><span class="toc-number"></span> <span class="toc-text">立即执行函数</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#Js"><span class="toc-number"></span> <span class="toc-text">Js</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E6%97%B6%E9%97%B4-1"><span class="toc-number">1.</span> <span class="toc-text">获取当前时间</span></a></li></ol></div></div></div></div></main><footer id="footer" style="background-image: url('https://img1.baidu.com/it/u=2163263263,2058666557&amp;fm=253&amp;fmt=auto&amp;app=138&amp;f=JPEG?w=500&amp;h=497')"><div id="footer-wrap"><div class="copyright">&copy;2022 - 2023 By 晚夜微雨问海棠</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">繁</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="chat_btn" type="button" title="聊天"><i class="fas fa-sms"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div></div></div><div id="search-mask"></div></div><div id="rightMenu"><div class="rightMenu-group rightMenu-small"><div class="rightMenu-item" id="menu-backward"><i class="fa-solid fa-arrow-left"></i></div><div class="rightMenu-item" id="menu-forward"><i class="fa-solid fa-arrow-right"></i></div><div class="rightMenu-item" id="menu-refresh"><i class="fa-solid fa-arrow-rotate-right"></i></div><div class="rightMenu-item" id="menu-home"><i class="fa-solid fa-house"></i></div></div><div class="rightMenu-group rightMenu-line rightMenuOther"><a class="rightMenu-item menu-link" href="/archives/"><i class="fa-solid fa-archive"></i><span>文章归档</span></a><a class="rightMenu-item menu-link" href="/categories/"><i class="fa-solid fa-folder-open"></i><span>文章分类</span></a><a class="rightMenu-item menu-link" href="/tags/"><i class="fa-solid fa-tags"></i><span>文章标签</span></a></div><div class="rightMenu-group rightMenu-line rightMenuNormal"><div class="rightMenu-item" id="menu-translate"><i class="fa-solid fa-earth-asia"></i><span>繁简切换</span></div><div class="rightMenu-item" id="menu-darkmode"><i class="fa-solid fa-moon"></i><span>切换模式</span></div></div></div><div id="rightmenu-mask"></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.min.js"></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><script src="/js/search/local-search.js"></script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())</script><div class="js-pjax"><script>(() => {
  const $mermaidWrap = document.querySelectorAll('#article-container .mermaid-wrap')
  if ($mermaidWrap.length) {
    window.runMermaid = () => {
      window.loadMermaid = true
      const theme = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'default'

      Array.from($mermaidWrap).forEach((item, index) => {
        const mermaidSrc = item.firstElementChild
        const mermaidThemeConfig = '%%{init:{ \'theme\':\'' + theme + '\'}}%%\n'
        const mermaidID = 'mermaid-' + index
        const mermaidDefinition = mermaidThemeConfig + mermaidSrc.textContent
        mermaid.mermaidAPI.render(mermaidID, mermaidDefinition, (svgCode) => {
          mermaidSrc.insertAdjacentHTML('afterend', svgCode)
        })
      })
    }

    const loadMermaid = () => {
      window.loadMermaid ? runMermaid() : getScript('https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js').then(runMermaid)
    }

    window.pjax ? loadMermaid() : document.addEventListener('DOMContentLoaded', loadMermaid)
  }
})()</script><script>function loadValine () {
  function initValine () {
    const valine = new Valine(Object.assign({
      el: '#vcomment',
      appId: '',
      appKey: '',
      avatar: 'monsterid',
      serverURLs: '',
      emojiMaps: "",
      path: window.location.pathname,
      visitor: false
    }, null))
  }

  if (typeof Valine === 'function') initValine() 
  else getScript('https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js').then(initValine)
}

if ('Valine' === 'Valine' || !true) {
  if (true) btf.loadComment(document.getElementById('vcomment'),loadValine)
  else setTimeout(loadValine, 0)
} else {
  function loadOtherComment () {
    loadValine()
  }
}</script></div><div class="aplayer no-destroy" data-id="7625372994" data-server="netease" data-type="playlist" data-fixed="true" data-autoplay="true"> </div> <script defer src="https://npm.elemecdn.com/jquery@latest/dist/jquery.min.js"></script> <script src="/swiper/swiper.min.js"></script> <script src="/swiper/swiperindex.js"></script> <script src="//cdn.bootcss.com/pace/1.0.2/pace.min.js"></script> <script src="/js/title.js"></script> <script defer data-pjax src="/js/cat.js"></script> <script defer data-pjax src="/js/rightMenu.js"></script><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/activate-power-mode.min.js"></script><script>POWERMODE.colorful = true;
POWERMODE.shake = false;
POWERMODE.mobile = false;
document.body.addEventListener('input', POWERMODE);
</script><script id="click-heart" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/click-heart.min.js" async="async" mobile="false"></script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/metingjs/dist/Meting.min.js"></script><script src="https://cdn.jsdelivr.net/npm/pjax/pjax.min.js"></script><script>let pjaxSelectors = ["head > title","#config-diff","#body-wrap","#rightside-config-hide","#rightside-config-show","#web_bg",".js-pjax"]

var pjax = new Pjax({
  elements: 'a:not([target="_blank"])',
  selectors: pjaxSelectors,
  cacheBust: false,
  analytics: false,
  scrollRestoration: false
})

document.addEventListener('pjax:send', function () {

  // removeEventListener scroll 
  window.tocScrollFn && window.removeEventListener('scroll', window.tocScrollFn)
  window.scrollCollect && window.removeEventListener('scroll', scrollCollect)

  typeof preloader === 'object' && preloader.initLoading()
  document.getElementById('rightside').style.cssText = "opacity: ''; transform: ''"
  
  if (window.aplayers) {
    for (let i = 0; i < window.aplayers.length; i++) {
      if (!window.aplayers[i].options.fixed) {
        window.aplayers[i].destroy()
      }
    }
  }

  typeof typed === 'object' && typed.destroy()

  //reset readmode
  const $bodyClassList = document.body.classList
  $bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')

  typeof disqusjs === 'object' && disqusjs.destroy()
})

document.addEventListener('pjax:complete', function () {
  window.refreshFn()

  document.querySelectorAll('script[data-pjax]').forEach(item => {
    const newScript = document.createElement('script')
    const content = item.text || item.textContent || item.innerHTML || ""
    Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value))
    newScript.appendChild(document.createTextNode(content))
    item.parentNode.replaceChild(newScript, item)
  })

  GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()

  typeof chatBtnFn === 'function' && chatBtnFn()
  typeof panguInit === 'function' && panguInit()

  // google analytics
  typeof gtag === 'function' && gtag('config', '', {'page_path': window.location.pathname});

  // baidu analytics
  typeof _hmt === 'object' && _hmt.push(['_trackPageview',window.location.pathname]);

  typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()

  // prismjs
  typeof Prism === 'object' && Prism.highlightAll()

  typeof preloader === 'object' && preloader.endLoading()
})

document.addEventListener('pjax:error', (e) => {
  if (e.request.status === 404) {
    pjax.loadUrl('/404.html')
  }
})</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><!-- hexo injector body_end start --><script data-pjax>function history_calendar_injector_config(){
                var parent_div_git = document.getElementsByClassName('sticky_layout')[0];
                var item_html = '<div class="card-widget card-history"><div class="card-content"><div class="item-headline"><i class="fas fa-clock fa-spin"></i><span>那年今日</span></div><div id="history-baidu" style="height: 100px;overflow: hidden"><div class="history_swiper-container" id="history-container" style="width: 100%;height: 100%"><div class="swiper-wrapper" id="history_container_wrapper" style="height:20px"></div></div></div></div>';
                console.log('已挂载history_calendar')
                // parent_div_git.innerHTML=item_html+parent_div_git.innerHTML // 无报错，但不影响使用(支持pjax跳转)
                parent_div_git.insertAdjacentHTML("afterbegin",item_html) // 有报错，但不影响使用(支持pjax跳转)
            }if( document.getElementsByClassName('sticky_layout')[0] && (location.pathname ==='/'|| '/' ==='all')){

            history_calendar_injector_config()
        } </script><script data-pjax  src="https://cdn.jsdelivr.net/npm/swiper/swiper-bundle.min.js"></script><script data-pjax src="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-card-history/baiduhistory/js/main.js"></script><script data-pjax>
    function butterfly_categories_card_injector_config(){
      var parent_div_git = document.getElementById('recent-posts');
      var item_html = '<style>li.categoryBar-list-item{width:24%;}.categoryBar-list{max-height: 190px;overflow:auto;}.categoryBar-list::-webkit-scrollbar{width:0!important}@media screen and (max-width: 650px){.categoryBar-list{max-height: 160px;}}</style><div class="recent-post-item" style="height:auto;width:100%;padding:0px;"><div id="categoryBar"><ul class="categoryBar-list"><li class="categoryBar-list-item" style="background:url(https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpicnew6.photophoto.cn%2F20120106%2Fhaimianbaobaotupian-10036689_1.jpg&amp;refer=http%3A%2F%2Fpicnew6.photophoto.cn&amp;app=2002&amp;size=f9999,10000&amp;q=a80&amp;n=0&amp;g=0n&amp;fmt=auto?sec=1665648815&amp;t=a3deb15ddd7a38597964c3a05e519bd7);"> <a class="categoryBar-list-link" onclick="pjax.loadUrl(&quot;categories/Asp-Net/&quot;);" href="javascript:void(0);">Asp.Net</a><span class="categoryBar-list-count">1</span><span class="categoryBar-list-descr"></span></li><li class="categoryBar-list-item" style="background:url(https://npm.elemecdn.com/anzhiyu-blog@1.1.6/img/post/common/site-backgound.jpg);"> <a class="categoryBar-list-link" onclick="pjax.loadUrl(&quot;categories/C-系列/&quot;);" href="javascript:void(0);">C#系列</a><span class="categoryBar-list-count">8</span><span class="categoryBar-list-descr"></span></li><li class="categoryBar-list-item" style="background:url(https://gimg2.baidu.com/image_search/src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_bt%2F0%2F13012860773%2F1000.jpg&amp;refer=http%3A%2F%2Finews.gtimg.com&amp;app=2002&amp;size=f9999,10000&amp;q=a80&amp;n=0&amp;g=0n&amp;fmt=auto?sec=1665648865&amp;t=1d2f13b52a7e279e8801545f59eda4e7);"> <a class="categoryBar-list-link" onclick="pjax.loadUrl(&quot;categories/Hexo重装记录/&quot;);" href="javascript:void(0);">Hexo重装记录</a><span class="categoryBar-list-count">2</span><span class="categoryBar-list-descr"></span></li><li class="categoryBar-list-item" style="background:url(https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fc-ssl.duitang.com%2Fuploads%2Fblog%2F202011%2F07%2F20201107183300_ac0c5.thumb.1000_0.jpeg&amp;refer=http%3A%2F%2Fc-ssl.duitang.com&amp;app=2002&amp;size=f9999,10000&amp;q=a80&amp;n=0&amp;g=0n&amp;fmt=auto?sec=1665648887&amp;t=3d32c6b12a4cf12e5cec3585b79c1fc3);"> <a class="categoryBar-list-link" onclick="pjax.loadUrl(&quot;categories/EF/&quot;);" href="javascript:void(0);">EF</a><span class="categoryBar-list-count">1</span><span class="categoryBar-list-descr"></span></li><li class="categoryBar-list-item" style="background:url(https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fup.enterdesk.com%2Fedpic%2F25%2Feb%2F1f%2F25eb1fd40b5a740c2b79e33f700806e5.jpg&amp;refer=http%3A%2F%2Fup.enterdesk.com&amp;app=2002&amp;size=f9999,10000&amp;q=a80&amp;n=0&amp;g=0n&amp;fmt=auto?sec=1665648908&amp;t=6425ee3bd166b0f5c5ffa6fb18b6937b);"> <a class="categoryBar-list-link" onclick="pjax.loadUrl(&quot;categories/LOL/&quot;);" href="javascript:void(0);">LOL</a><span class="categoryBar-list-count">1</span><span class="categoryBar-list-descr"></span></li><li class="categoryBar-list-item" style="background:url(https://gimg2.baidu.com/image_search/src=http%3A%2F%2Flmg.jj20.com%2Fup%2Fallimg%2Ftx26%2F36080017392073.jpg&amp;refer=http%3A%2F%2Flmg.jj20.com&amp;app=2002&amp;size=f9999,10000&amp;q=a80&amp;n=0&amp;g=0n&amp;fmt=auto?sec=1665650136&amp;t=5cc414d0ee58c9e285218d92f6a95513);"> <a class="categoryBar-list-link" onclick="pjax.loadUrl(&quot;categories/idea/&quot;);" href="javascript:void(0);">idea</a><span class="categoryBar-list-count">1</span><span class="categoryBar-list-descr"></span></li><li class="categoryBar-list-item" style="background:url(https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fn.sinaimg.cn%2Fsinacn10%2F320%2Fw700h420%2F20180907%2F5116-hitesuz6599636.jpg&amp;refer=http%3A%2F%2Fn.sinaimg.cn&amp;app=2002&amp;size=f9999,10000&amp;q=a80&amp;n=0&amp;g=0n&amp;fmt=auto?sec=1665650004&amp;t=6a304aa9cc7435ec1d148b8f99092bc0);"> <a class="categoryBar-list-link" onclick="pjax.loadUrl(&quot;categories/世界/&quot;);" href="javascript:void(0);">世界</a><span class="categoryBar-list-count">1</span><span class="categoryBar-list-descr"></span></li><li class="categoryBar-list-item" style="background:url(https://s1.ax1x.com/2022/11/15/zAxCi6.jpg);"> <a class="categoryBar-list-link" onclick="pjax.loadUrl(&quot;categories/世界见闻录/&quot;);" href="javascript:void(0);">世界见闻录</a><span class="categoryBar-list-count">8</span><span class="categoryBar-list-descr"></span></li><li class="categoryBar-list-item" style="background:url(https://s1.ax1x.com/2022/11/15/zAxFzD.jpg);"> <a class="categoryBar-list-link" onclick="pjax.loadUrl(&quot;categories/前端体系/&quot;);" href="javascript:void(0);">前端体系</a><span class="categoryBar-list-count">19</span><span class="categoryBar-list-descr"></span></li><li class="categoryBar-list-item" style="background:url(https://s1.ax1x.com/2022/11/15/zAxnot.jpg);"> <a class="categoryBar-list-link" onclick="pjax.loadUrl(&quot;categories/副业/&quot;);" href="javascript:void(0);">副业</a><span class="categoryBar-list-count">1</span><span class="categoryBar-list-descr"></span></li><li class="categoryBar-list-item" style="background:url(https://s1.ax1x.com/2022/11/15/zAxMJf.jpg);"> <a class="categoryBar-list-link" onclick="pjax.loadUrl(&quot;categories/文案/&quot;);" href="javascript:void(0);">文案</a><span class="categoryBar-list-count">6</span><span class="categoryBar-list-descr"></span></li><li class="categoryBar-list-item" style="background:url(https://s1.ax1x.com/2022/11/15/zAxQW8.jpg);"> <a class="categoryBar-list-link" onclick="pjax.loadUrl(&quot;categories/办公日常/&quot;);" href="javascript:void(0);">办公日常</a><span class="categoryBar-list-count">2</span><span class="categoryBar-list-descr"></span></li><li class="categoryBar-list-item" style="background:url(https://s1.ax1x.com/2022/11/15/zAx3Qg.jpg);"> <a class="categoryBar-list-link" onclick="pjax.loadUrl(&quot;categories/朝花夕拾/&quot;);" href="javascript:void(0);">朝花夕拾</a><span class="categoryBar-list-count">12</span><span class="categoryBar-list-descr"></span></li><li class="categoryBar-list-item" style="background:url(https://s1.ax1x.com/2022/11/15/zAxYes.jpg);"> <a class="categoryBar-list-link" onclick="pjax.loadUrl(&quot;categories/前端/&quot;);" href="javascript:void(0);">前端</a><span class="categoryBar-list-count">20</span><span class="categoryBar-list-descr"></span></li><li class="categoryBar-list-item" style="background:url(undefined);"> <a class="categoryBar-list-link" onclick="pjax.loadUrl(&quot;categories/杂七杂八/&quot;);" href="javascript:void(0);">杂七杂八</a><span class="categoryBar-list-count">7</span><span class="categoryBar-list-descr"></span></li><li class="categoryBar-list-item" style="background:url(undefined);"> <a class="categoryBar-list-link" onclick="pjax.loadUrl(&quot;categories/简书/&quot;);" href="javascript:void(0);">简书</a><span class="categoryBar-list-count">5</span><span class="categoryBar-list-descr"></span></li><li class="categoryBar-list-item" style="background:url(undefined);"> <a class="categoryBar-list-link" onclick="pjax.loadUrl(&quot;categories/游戏/&quot;);" href="javascript:void(0);">游戏</a><span class="categoryBar-list-count">1</span><span class="categoryBar-list-descr"></span></li></ul></div></div>';
      console.log('已挂载butterfly_categories_card')
      parent_div_git.insertAdjacentHTML("afterbegin",item_html)
      }
    if( document.getElementById('recent-posts') && (location.pathname ==='/'|| '/' ==='all')){
    butterfly_categories_card_injector_config()
    }
  </script><script data-pjax>
  function butterfly_clock_anzhiyu_injector_config(){
    var parent_div_git = document.getElementsByClassName('sticky_layout')[0];
    var item_html = '<div class="card-widget card-clock"><div class="card-glass"><div class="card-background"><div class="card-content"><div id="hexo_electric_clock"><img class="entered loading" id="card-clock-loading" src= "" data-lazy-src="https://cdn.cbd.int/hexo-butterfly-clock-anzhiyu/lib/loading.gif" style="height: 120px; width: 100%;" data-ll-status="loading"/></div></div></div></div></div>';
    console.log('已挂载butterfly_clock_anzhiyu')
    parent_div_git.insertAdjacentHTML("afterbegin",item_html)
    }
  var elist = 'null'.split(',');
  var cpage = location.pathname;
  var epage = '/';
  var qweather_key = '41ea442da35546559913a6a5d54163b2';
  var gaud_map_key = '6b62fbebf584b9a22a85bfccbf90335e';
  var baidu_ak_key = 'undefined';
  var flag = 0;
  var clock_rectangle = '114.35,34.79';
  var clock_default_rectangle_enable = 'true';

  for (var i=0;i<elist.length;i++){
    if (cpage.includes(elist[i])){
      flag++;
    }
  }

  if ((epage ==='all')&&(flag == 0)){
    butterfly_clock_anzhiyu_injector_config();
  }
  else if (epage === cpage){
    butterfly_clock_anzhiyu_injector_config();
  }
  </script><script src="https://widget.qweather.net/simple/static/js/he-simple-common.js?v=2.0"></script><script data-pjax src="https://cdn.cbd.int/hexo-butterfly-clock-anzhiyu/lib/clock.min.js"></script><script data-pjax>
  function butterfly_footer_beautify_injector_config(){
    var parent_div_git = document.getElementById('footer-wrap');
    var item_html = '<div id="workboard"></div><p id="ghbdages"><a class="github-badge" target="_blank" href="https://hexo.io/" style="margin-inline:5px" data-title="博客框架为Hexo_v5.4.0" title=""><img src= "" data-lazy-src="https://img.shields.io/badge/Frame-Hexo-blue?style=flat&amp;logo=hexo" alt=""/></a><a class="github-badge" target="_blank" href="https://butterfly.js.org/" style="margin-inline:5px" data-title="主题版本Butterfly_v4.2.2" title=""><img src= "" data-lazy-src="https://img.shields.io/badge/Theme-Butterfly-6513df?style=flat&amp;logo=bitdefender" alt=""/></a><a class="github-badge" target="_blank" href="https://www.jsdelivr.com/" style="margin-inline:5px" data-title="本站使用JsDelivr为静态资源提供CDN加速" title=""><img src= "" data-lazy-src="https://img.shields.io/badge/CDN-jsDelivr-orange?style=flat&amp;logo=jsDelivr" alt=""/></a><a class="github-badge" target="_blank" href="http://creativecommons.org/licenses/by-nc-sa/4.0/" style="margin-inline:5px" data-title="本站采用知识共享署名-非商业性使用-相同方式共享4.0国际许可协议进行许可" title=""><img src= "" data-lazy-src="https://img.shields.io/badge/Copyright-BY--NC--SA%204.0-d42328?style=flat&amp;logo=Claris" alt=""/></a></p>';
    console.log('已挂载butterfly_footer_beautify')
    parent_div_git.insertAdjacentHTML("beforeend",item_html)
    }
  var elist = 'null'.split(',');
  var cpage = location.pathname;
  var epage = 'all';
  var flag = 0;

  for (var i=0;i<elist.length;i++){
    if (cpage.includes(elist[i])){
      flag++;
    }
  }

  if ((epage ==='all')&&(flag == 0)){
    butterfly_footer_beautify_injector_config();
  }
  else if (epage === cpage){
    butterfly_footer_beautify_injector_config();
  }
  </script><script async src="/js/runtime/runtime.min.js"></script><script data-pjax>
  function butterfly_swiper_injector_config(){
    var parent_div_git = document.getElementById('recent-posts');
    var item_html = '<div class="recent-post-item swiper_container_card" style="height: auto;width: 100%"><div id="random"><div id="random-banner"><canvas id="peoplecanvas"></canvas></div><a id="random-hover" style="width:100%;height:auto;" href="javascript:toRandomPost()" rel="external nofollow noreferrer" one-link-mark="yes"><i class="fa fa-paper-plane" style="margin-left:10px"></i><div style="margin-left:10px">随便逛逛<i class="fa-solid fa-arrow-right" style="margin-left:10px"></i></div></a></div><div class="blog-slider swiper-container-fade swiper-container-horizontal" id="swiper_container"><div class="blog-slider__wrp swiper-wrapper" style="transition-duration: 0ms;"><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/67fcd28d.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src= "" data-lazy-src="https://img2.baidu.com/it/u=4087346614,241521689&amp;fm=253&amp;fmt=auto&amp;app=138&amp;f=JPEG?w=500&amp;h=333" alt="" onerror="this.src=https://cdn.cbd.int/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2022-09-19</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/67fcd28d.html&quot;);" href="javascript:void(0);" alt="">学生人到职业人_心态篇</a><div class="blog-slider__text">再怎么看我也不知道怎么描述它的啦！</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/67fcd28d.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/8a73f76c.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src= "" data-lazy-src="https://s1.ax1x.com/2022/11/04/xLiBTA.jpg" alt="" onerror="this.src=https://cdn.cbd.int/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2022-11-04</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/8a73f76c.html&quot;);" href="javascript:void(0);" alt="">生活の奇思妙想☞2022</a><div class="blog-slider__text">再怎么看我也不知道怎么描述它的啦！</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/8a73f76c.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/14e5dae6.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src= "" data-lazy-src="https://s1.ax1x.com/2022/10/21/xcAQDH.jpg" alt="" onerror="this.src=https://cdn.cbd.int/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2022-11-12</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/14e5dae6.html&quot;);" href="javascript:void(0);" alt="">少年自负凌云笔</a><div class="blog-slider__text">再怎么看我也不知道怎么描述它的啦！</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/14e5dae6.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/9b7092b7.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src= "" data-lazy-src="https://s1.ax1x.com/2022/10/11/xNJbF0.jpg" alt="" onerror="this.src=https://cdn.cbd.int/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2022-09-13</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/9b7092b7.html&quot;);" href="javascript:void(0);" alt="">租房有感</a><div class="blog-slider__text">再怎么看我也不知道怎么描述它的啦！</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/9b7092b7.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/94bbc7d.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src= "" data-lazy-src="https://s1.ax1x.com/2022/10/11/xNJLWT.jpg" alt="" onerror="this.src=https://cdn.cbd.int/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2022-09-25</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/94bbc7d.html&quot;);" href="javascript:void(0);" alt="">谷歌收藏</a><div class="blog-slider__text">再怎么看我也不知道怎么描述它的啦！</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/94bbc7d.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/3b350f14.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src= "" data-lazy-src="https://s1.ax1x.com/2022/10/11/xNJJd1.jpg" alt="" onerror="this.src=https://cdn.cbd.int/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2022-09-13</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/3b350f14.html&quot;);" href="javascript:void(0);" alt="">阳光不燥、微风正好</a><div class="blog-slider__text">再怎么看我也不知道怎么描述它的啦！</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/3b350f14.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div></div><div class="blog-slider__pagination swiper-pagination-clickable swiper-pagination-bullets"></div></div></div>';
    console.log('已挂载butterfly_swiper')
    parent_div_git.insertAdjacentHTML("afterbegin",item_html)
    }
  var elist = 'undefined'.split(',');
  var cpage = location.pathname;
  var epage = '/';
  var flag = 0;

  for (var i=0;i<elist.length;i++){
    if (cpage.includes(elist[i])){
      flag++;
    }
  }

  if ((epage ==='all')&&(flag == 0)){
    butterfly_swiper_injector_config();
  }
  else if (epage === cpage){
    butterfly_swiper_injector_config();
  }
  </script><script defer src="https://npm.elemecdn.com/anzhiyu-blog@1.1.6/js/swiper.min.js"></script><script defer data-pjax src="https://cdn.cbd.int/hexo-butterfly-swiper-anzhiyu@1.0.4/lib/swiper_init.js"></script><script data-pjax src="https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/gsap/3.9.1/gsap.min.js"></script><script defer src="https://npm.elemecdn.com/hexo-butterfly-swiper-anzhiyu@1.0.4/lib/people.min.js"></script><script async src="/anzhiyu/random.js"></script><div class="js-pjax"><script async="async">var arr = document.getElementsByClassName('recent-post-item');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__zoomIn');
    arr[i].setAttribute('data-wow-duration', '1.5s');
    arr[i].setAttribute('data-wow-delay', '200ms');
    arr[i].setAttribute('data-wow-offset', '30');
    arr[i].setAttribute('data-wow-iteration', '1');
  }</script><script async="async">var arr = document.getElementsByClassName('card-widget');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__zoomIn');
    arr[i].setAttribute('data-wow-duration', '');
    arr[i].setAttribute('data-wow-delay', '200ms');
    arr[i].setAttribute('data-wow-offset', '');
    arr[i].setAttribute('data-wow-iteration', '');
  }</script><script async="async">var arr = document.getElementsByClassName('flink-list-card');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__flipInY');
    arr[i].setAttribute('data-wow-duration', '3s');
    arr[i].setAttribute('data-wow-delay', '');
    arr[i].setAttribute('data-wow-offset', '');
    arr[i].setAttribute('data-wow-iteration', '');
  }</script><script async="async">var arr = document.getElementsByClassName('flink-list-card');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__animated');
    arr[i].setAttribute('data-wow-duration', '3s');
    arr[i].setAttribute('data-wow-delay', '');
    arr[i].setAttribute('data-wow-offset', '');
    arr[i].setAttribute('data-wow-iteration', '');
  }</script><script async="async">var arr = document.getElementsByClassName('article-sort-item');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__slideInRight');
    arr[i].setAttribute('data-wow-duration', '1.5s');
    arr[i].setAttribute('data-wow-delay', '');
    arr[i].setAttribute('data-wow-offset', '');
    arr[i].setAttribute('data-wow-iteration', '');
  }</script><script async="async">var arr = document.getElementsByClassName('site-card');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__flipInY');
    arr[i].setAttribute('data-wow-duration', '3s');
    arr[i].setAttribute('data-wow-delay', '');
    arr[i].setAttribute('data-wow-offset', '');
    arr[i].setAttribute('data-wow-iteration', '');
  }</script><script async="async">var arr = document.getElementsByClassName('site-card');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__animated');
    arr[i].setAttribute('data-wow-duration', '3s');
    arr[i].setAttribute('data-wow-delay', '');
    arr[i].setAttribute('data-wow-offset', '');
    arr[i].setAttribute('data-wow-iteration', '');
  }</script></div><script defer src="https://cdn.cbd.int/hexo-butterfly-wowjs/lib/wow.min.js"></script><script defer src="https://cdn.cbd.int/hexo-butterfly-wowjs/lib/wow_init.js"></script><script async src="/js/ali_font.js"></script><!-- hexo injector body_end end --><script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"tagMode":false,"debug":false,"model":{"jsonPath":"/live2dw/assets/koharu.model.json"},"display":{"position":"left","width":150,"height":300},"mobile":{"show":false},"log":false,"pluginJsPath":"lib/","pluginModelPath":"assets/","pluginRootPath":"live2dw/"});</script></body></html>